Despite my best efforts, my media streaming server still dies sometimes and I am in a random place trying to ssh into the server to restart it on my cell phone after customers start calling.... I tried using google to track down a script that would do the following
Every 5 min execute:
sudo /etc/init.d/WowzaMediaServer status
Then it would grep the returned text for "started" and if it isn't found would execute:
sudo /etc/init.d/WowzaMediaServer start
I am not sure how to setup the script + it is going to ask for a password to use the sudo command.
Anybody able to give me a hand? Seems like a nice script that many people should have on hand anyway.
You probably don't need sudo just to do /etc/init.d/service status. Which is fortunate since running sudo every five minutes could fill your logfiles with pointless junk.
sudo can be configured to let a certain user run a certain program without a password.
I'd just have cron run a script file. If checking every hour is fine, you could just put the script in /etc/cron.hourly/check-mediaserver.sh and it'd run it hourly under the cron user.
In the script file:
Depending on your init system this may generate output that'd get mailed by your cron daemon if it can, or end up in dead.letter if it can't.
You can edit your sudo permissions as root with visudo. You could add a line like:
...which would let the cron user run /etc/init.d/WozxaMediaServer as root without a password.
Last edited by Corona688; 08-12-2010 at 02:28 PM..
Hi,
1)
If some job supposed to run on 1st of every month at 7 AM
In cron job when we have a blackout on the 1st ( i.e when 1st falls on a sunday ) how can we make the job run the next business day?
2) How can we run a job on 25th of every quarter 7 AM(jan,apr,jul,oct)
And if 25th... (5 Replies)
Hi ,
I have removed a cron for particular user , but cron job seems to be running even after the cron entry is removed. The purpose of the cron was to sendmail to user ( it uses mailx utility )
I have restarted cron and sendmail service still user is getting mail alerts from the cron job. And... (4 Replies)
i have a text file in this format: which creates a new one everyday in the form of filename _zing__r200_2012_8_10_log.txt
Fri Aug 10 07:29:17 EDT 2012, usera(192.168.0.245) to anotheruser: hey top, this is a private test
Fri Aug 10 07:29:28 EDT 2012, anotheruser(192.168.0.245) to usera: got... (2 Replies)
I wrote a quick little script that will eventually end up as a cron job to export rrd files for my cacti server.
Here is the script:
#!/bin/bash
rm -rf /backup/cacti_xml/*
cd /var/www/html/rra
ls -1 *.rrd | awk '{print "rrdtool dump "$1" > /backup/cacti_xml/"$1".xml"}' | sh -x
Is there... (5 Replies)
Due to downsizing and attrition, I have inherited SysAdmin tasks, but unfortunately not all the required knowledge and skills came to me along with the assignment -> so I appreciate any advice and help ( be patient with my newbie terms and questions).
We moved a central server and changed it's... (1 Reply)
Hi,
I'm very new to Unix so please bear with me... :)
Here is my requirement:
I need to create a cron job to run two different scripts at 1 a.m. every day.
Here's what I did:
I used the "crontab -e" command and created a crontab file using the vi editor.
When I exit the editor using... (3 Replies)
Hi!
I'm using a script to start a process that might run forever if some parameters are given wrong (it's part of an optimization). I would now like to have the process killed after a certain walltime in that case. So far I get it done with the following lines
./My_process.e &
pid=`ps -ef |... (3 Replies)
Thanks for the all the help last evening on CRON jobs. It's now working.
Is it possible with cron to save a backup of a file to a different server or location? The idea being that if one host goes arse over tit, I'll have a backup of the DB on another server?
Many thanks,
Ed Ludlow (3 Replies)