#! /bin/csh -f # awake_cron # Demise, June 26, 2000. # Make sure this file is executable: "chmod u+x awake_cron" # cron should run this script. # To do that, run "crontab -e". # Assuming this file is called /home/awake/mud/awake_cron, # add the following two lines, without the surrounding "": # "# Check every minute for Awake's startup script" # "* * * * * /home/shadows/Awake/awake_cron" # The following line lists all processes running by the # current user (the x flag shows even background ones, # w flag makes it a wide listing). It then removes any # "grep" processes from the list, and then shows any of # the remaining that contain the word "autorun" # Note: the result should be "no" if it's not running, # and something else if it is. set test_autorun=no`ps xw | grep -v grep | grep autorun` # The following line does the same, for "startup" set test_startup=no`ps xw | grep -v grep | grep startup` # Same for 'sleep' set test_sleep=no`ps xw | grep -v grep | grep startup` # Make the actual tests. (startup test taken out to not conflict if (("$test_autorun" == 'no') && ("$test_sleep" == 'no') ) then # Uncomment this line if you want the account mailed when # the mud starts up. echo `date`: Starting Awake. # Change directory. cd /home/awake/mud/ # Start the mud in the background and pipe the process number # that backgrounding outputs to /dev/null (/home/awake/mud/autorun &) >& /dev/null endif # Done