The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
create a shell script that calls another script and and an awk script magikminox Shell Programming and Scripting 0 06-26-2008 02:50 AM
Shell Script: want to insert values in database when update script runs ring Shell Programming and Scripting 1 10-25-2007 03:06 AM
Include xhost + at auto reboot script KhawHL Shell Programming and Scripting 0 12-07-2006 12:14 AM
Auto answer ( Yes or No) from unix script Nayanajith Shell Programming and Scripting 3 08-22-2006 01:29 AM
Auto Alias Script coolboarderguy Shell Programming and Scripting 3 12-25-2005 09:11 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-27-2008
elDeuce elDeuce is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 4
Shell Script to Auto Run PHP Script

Hello All!

I am looking to build a monitoring script.

The script should always run as a system service of some type and should always check that a PHP script is running.

Maybe there is a way to assign a PHP script to a certain PID so that the monitor script that check for the PID in top and then if the PID does not exist, then have it run the PHP script.

Basically, I have built a PHP script the constantly monitors two sets of databases to verify that they remain the same and if one DB changes it writes it to the other.
There are MANY MANY reasons for it be done this way versus other possible ways. Mainly because of other functions this script does that due to lots of fun legal paperwork I can't disclose.

So, all in all...
Need a bash/shell script that will constantly check for my PHP script to make sure it is running and make it run if it doesn't exist.

I'm just tired of having a putty window open and my internet dieing and killing the script.

Any help or pointing in the right direction would be of tremendous help.
Thank you for your time!!!
  #2 (permalink)  
Old 08-28-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
My "Bread and Butter" Process Keep Alive Perl Script....
Script to test for scripts running
  #3 (permalink)  
Old 08-28-2008
broli's Avatar
broli broli is offline
Registered User
  
 

Join Date: Dec 2007
Location: Argentina
Posts: 215
Quote:
Originally Posted by elDeuce View Post

I'm just tired of having a putty window open and my internet dieing and killing the script.
besides what era said. if im not reading this wrong, then you dont know about "nohup" or "screen"

they both have (in different ways) the ability to launch a program/script and they wont die when you close the putty session
  #4 (permalink)  
Old 08-28-2008
elDeuce elDeuce is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 4
Thank you era for those two scripts, I think I should be able to come up with something handy off of those.

No, I had not heard of nohup or screen, but maybe something like that will work for other processes. My deal is that I don't want the process to die unknowingly.

Is it possible to have a PHP script always pull the exact same PID?

Thanks!
  #5 (permalink)  
Old 08-28-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
But as noted elsewhere, if keeping things running is really important, cron is better than screen or nohup, because it will recover even if the system runs out of resources and kills, say, your process monitoring process. (Of course, if your cron daemon is killed, you are pretty much beyond hope ...)
Closed Thread

Bookmarks

Tags
keepalive, monitor, php, script, shell, shll

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:25 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0