Register | Member List | Search | FAQ | Stats

< Ubuntu 8.04  
halp with mysql > New Topic  Post Reply
Need a batch file! Process Watcher.         525 reads

If you want to keep your tongue, don't lick me in the Winter!


SSHOLE


Posts: 476
Registered: 10/14/2004
Offline

5/13/2008 at 17:07
Hey folks... I gotta dumb problem at work I thought you guys might be able to help with.

I would like to run a batch file somehow every 5 min that will check to see if a process is running on a server. If it is running perfect. If not, I want to run another batch file I have written to start the process in question with some parameters...

Is there an easy way to do this?

Thanks!

 
Reply With Quote

Bad Taste in your Mouth


SSHOLE

Posts: 4338
Registered: 3/8/2002
Offline

5/13/2008 at 17:36

is there an easy way to do this?

You probably won't get any mileage out of Windows' 'Scheduled Tasks', as it sucks. It won't let you do things every 5 minutes, for example.

I'd look here to start.

Otherwise, the only good way is also the only easy way: use a good old cron job in Unix or Linux. You'd have to rewrite your batch file or trigger it remotely somehow.






____________________
mundhra: And its crocobody is made of dile.
Reply With Quote Direct URL

If you want to keep your tongue, don't lick me in the Winter!


SSHOLE

Posts: 476
Registered: 10/14/2004
Offline

5/13/2008 at 17:44

I will check out link! Forgot to mention its on Windows Server.
Reply With Quote Direct URL

dread pirate neckbeard


SSHOLE

Posts: 1595
Registered: 3/25/2002
Offline

5/13/2008 at 22:39

we have a sleep.exe at work. i don't know where it came from (built by a developer?), but i uploaded a zip here. contents:

looptime.bat: calls settime.bat, sleeps for 5 minutes, loops infinitely
settime.bat: sets time against a server
sleep.exe: takes number of seconds as a param and waits

works on nt, 2k, etc.

On 2008-05-13 at 17:39:51, mundhra asked to smell your dick






____________________
...fuckabees
Reply With Quote Direct URL

Bad Taste in your Mouth


SSHOLE

Posts: 4338
Registered: 3/8/2002
Offline

5/13/2008 at 23:17

Oh nice, I forgot about that angle.

You'll probably end up with a command window open all the time, but if you can handle that, it's probably your best bet -- tiny, portable, self-documenting.






____________________
mundhra: And its crocobody is made of dile.
Reply With Quote Direct URL

dread pirate neckbeard


SSHOLE

Posts: 1595
Registered: 3/25/2002
Offline

5/14/2008 at 00:23

word.

personally, i'd probably write a perl script and run it without a console. :>>

also, you can use a program called firedaemon to turn it into a service. the demo version used to allow one program for an indefinite period, but i looked at the website and it looks like they changed to a 30 day demo. i could see about getting the old version if it's desired.






____________________
...fuckabees
Reply With Quote Direct URL

Tender vittles




Posts: 40
Registered: 1/28/2008
Offline

5/14/2008 at 07:55

first thought was vbs;

Set WshShell = CreateObject("WScript.Shell")
do
WshShell.Run "pathto\batch.bat"
wscript.sleep 300000
loop


bit dirty (and probably memory sucking)...

hey... its dirty and sucks... i wonder if it is interested in a long term commitment..?

-- btw only use this if necessary until you get something better sorted or the helpdesk emails stop rolling in!

On 2008-05-14 at 02:56:54, thefamousnomo asked to smell your dick






____________________
i have to return some video tapes
Reply With Quote Direct URL

dread pirate neckbeard


SSHOLE

Posts: 1595
Registered: 3/25/2002
Offline

5/14/2008 at 12:56

you could also probably use cron in cygwin, but i think you'd have to have the console open all the time. *shrug*






____________________
...fuckabees
Reply With Quote Direct URL

If you want to keep your tongue, don't lick me in the Winter!


SSHOLE

Posts: 476
Registered: 10/14/2004
Offline

5/14/2008 at 13:56

Guys you rock! Thanks! I will goof with this shit... The sleep works great...
Reply With Quote Direct URL

Token Discordian


SSHOLE

Posts: 933
Registered: 8/6/2005
Offline

5/14/2008 at 14:41

You can also use Windows Scheduled Tasks. After you create the task and click "finish", you have to open its properties again, go to the Schedule tab, then click on the "Advanced" button to set it to run every x minutes. I have a job running every ten minutes, that's been running reliably for years.

On 2008-05-14 at 09:43:32, jwalker asked to smell your dick






____________________
To the dog who has money, men say "My Lord Dog".
Reply With Quote Direct URL
< Ubuntu 8.04  
halp with mysql > New Topic  Post Reply


Powered by XForum 1.6n by Trollix Software
original script by xmb


QWERTY, DROP THE WURTHER'S ORIGINAL, AND STEP AWAY FROM THE CHILD!!! -- LORDKAHUNA