Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: cron.daily problem/question.  (Read 3569 times)

0 Members and 1 Guest are viewing this topic.

Simtech

  • Guest
cron.daily problem/question.
« on: August 26, 2011, 02:42:34 PM »
What is the difference between running a shell script (say in bash) and running it through cron.daily (or adding it to crontab)? I had thought that there would be no difference but (through experiment) have found that there must be one.
I have a script that finds the PID of a Konsole shell running a tail of a log, kills the PID, and then restarts the Konsole window with the tail of the new days log. I set this up to happen at 12:01 am every day (to switch the display to the new days log after the logs are rotated). The script works great when run from a separate Konsole shell, however, when run through cron.daily or crontab (I tried both) it will kill the present Konsole shell but will not start the new one.
The script is as follows (with commenting removed for brevity):

#!/bin/sh
SHUT=`ps aux | grep "konsole --vt_sz" | grep -v grep | awk '{print $2}'`
kill -9 $SHUT
konsole --vt_sz 132x15 -geometry +175+650 -e sh -c /path/to/script &

The computer in question is running Redhat 2.4.20 - rthal5.
Other bits...When run from the Konsole shell it is run as root. Crontab was edited as root. Killing the old shell requires root permissions but starting the new shell may be carried out by any user.

Thanks for any help.