Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I currently use an application called MxEasy on my linux servers to display video from a couple of IP cameras. The software is rather buggy and crashes occasionally. I've wrote a script that checks to see if the application is running and if its not... it launches the application.

I've tried adding this line to my crontab to have it run the script. It's running the script but not launching MxEasy. Any thing I'm over looking?

0,15,30,45,50 * * * * root  export DISPLAY=:0 && /etc/cron.hourly/MxEasyCheck.sh 

BTW Ubuntu Server 12.04 is the OS

Here is MxEasyCheck.sh

MXEASY=$(ps -A | grep -w MxEasy)

if ! [ -n "$MXEASY" ] ; then
    /home/emuser/bin/MxEasy/startMxEasy.sh &

Here is my crontab

# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.


# m h dom mon dow user  command
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
0  *    * * *   root    /etc/cron.hourly/rsynccheck.sh
0,15,30,45,50 * * * * root  export DISPLAY=:0 && /etc/cron.hourly/MxEasyCheck.sh 
share|improve this question
Error messages (likely sent to root mailbox)? Are you sure MxEasyCheck.sh is set to be executable as root? What does MxEasyCheck.sh look like? What about providing a FULL ip address with the DISPLAY variable? Without any of this type of information, nobody will be able to help you. – mdpc Nov 9 '12 at 18:20
Can I catch a break around here? I ether get told I'm posting too much information or too little...Why would I need to provide a IP address with the display command? the program is being launch on the local machine.. Permissions are set on MxEasyCheck.sh to chmod 754 – Matthew Nov 9 '12 at 18:50
I'm saying to try putting the full IP address in the assignment and trying that. Without seeing the script, about the only comment we might make is that what happens if the service the scripting calls gets called again when active? Other than that, there is nothing we could tell you. You have not indicated that you have searched the various error logs out there. – mdpc Nov 9 '12 at 19:00
Where does this entry come from? If it is in the root crontab, (ie. using crontab -e), then it has a syntax error by including root in the line. – mdpc Nov 9 '12 at 19:01
Root is included in all the other entries.. Also I've checked the syslog and script is being executed. "Nov 9 11:00:01 EMserver1 CRON[10533]: (root) CMD ( export DISPLAY=:0 && /etc/cron.hourly/MxEasyCheck.sh )" – Matthew Nov 9 '12 at 19:10
up vote 3 down vote accepted

Rather than check every few minutes, write a loop that relaunches the program when it terminates abnormally. But don't roll your own, there are plenty of existing programs to do that. See Ensure a process is always running

share|improve this answer

Consider to let your app to be spawn by init... see init(8) - keep things simple

share|improve this answer
Thank you I will look into this – Matthew Nov 13 '12 at 19:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.