[olug] cron job

Daniel Linder dan at linder.org
Tue Aug 2 03:41:17 UTC 2005


Jake Churchill said:
> How do I set a cron job to kill an application at a given time.  I have
> cron jobs set to start X applications.  For example, my alarm is set via
> cronjob to start an XMMS playlist.  I have a shell script to do this:
>
> #!/bin/sh
> export DISPLAY=:0.0
> /usr/bin/xmms /home/<username>/Desktop/Playlist.m3u

Here is one more option you can try.

Rewrite your script as follows:
 #!/bin/sh
 export DISPLAY=:0.0
 /usr/bin/xmms /home/<username>/Desktop/Playlist.m3u &
 echo $! > /tmp/alarm.pid
(note the addition of the "&" on line 3, also)

Then, to kill it all you have to do is this:
 kill -9 `cat /tmp/alarm.pid`

This way you can have xmms running on the desktop but not have it killed
by the "killall".

Dan

- - - -
"Wait for that wisest of all counselors, time." -- Pericles
"I do not fear computer, I fear the lack of them." -- Isaac Asimov
GPG fingerprint:9EE8 ABAE 10D3 0B55 C536  E17A 3620 4DCA A533 19BF



More information about the OLUG mailing list