ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
HI Iam trying to achieve the following through PHP:
1-Execute: jettop -i eth0 (no prob here)
2-Display the output in text area: (no prob here)
3-Refresh every 10 seconds (PLEASE HELP)
4-Close jettop when closed ( PLEASE HELP)
But the main problem is the following:
If the windows gets refreshed every 5 secs then the jettop program which is a network sniffer will be executed every 5 secs ...so it must be killed everytime the window is refreshed.
Or "and that is what Iam aiming for" I want to pipe the output of jettop to a php script and every 10 seconds I want to display the latest about that output and when the window is closed I want to close jettop.
You could use a variable in session or cookie which
indicate if jettop is already started.
something like :
PHP Code:
session_start();
if(!isset($_SESSION['jettop_is_started'])) { /* first lauch, jettop is not started yet */ /*... code to start jettop ... */ $_SESSION['jettop_is_started'] = true; }
if($I_want_stop_jettop_now) { /* if you want to stop jettop */ `killall jettop`; }
You will probably want to look at JavaScript to manage the "when a window is closed then close jetop" requirement. I'd suggest that you look at Ajax which can also manage the updating of your data without having to resend the entire page all the time. Sorry but I've no experience with Ajax - it's on my evergrowing list of things to learn next!
Thanks Graemef for your concern...Ive checked the link and Ajax seems to be promising...but you have to know that Iam new to PHP...and I do not know about javascript alot (else then using a few functions and that it is client based)...so is there a way to do the job in PHP instead ( in addition to what keefaz said)...I dont want to tap into a new thing right now
I which case I'd suggest that you hold off implementing it with Ajax but that you keep it at the back of your mind so that in the future when you feel more comfortable with php & javascript you can revisit it.
Hi
I was reading through my old posts..and I must say that Iam using AJAX right now to solve similar issues i should have used it straightaway at that time.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.