'kill' in bash script?
Derek Martin
dmartin at ne.arris-i.com
Sun Jan 30 02:58:07 EST 2000
On Sat, 29 Jan 2000, Ron Peterson wrote:
> I have the following line in a simple script file:
>
> ps ax | grep [b]ackfract | awk '{print $1}' | xargs -n1 kill
>
> The script works fine if I run it manually. But if I add it to my
> crontab, it won't work. I'm sure there is a simple explanation. Can
> someone help me with this?
Three things come to mind:
1) it's a path issue. cron runs commands with a limited path (usually
something like /bin:/usr/bin). If any of those commands are not in cron's
default path, you may need to set it explicitly in your script.
2) You didn't use the crontab command to edit your crontab. People are
sometimes mistaken in thinking that you can simply edit your crontab file
with vi and have it work. That's not the case. You need to use
the crontab command (I like the -e option) to edit your crontab. Check
the manpage for crontab(1) for details. [There is also a crontab(5)
manpage].
3) You are not allowed to use cron on your system. I forget off the top
of my head what you need to do to change that, but the manpages are your
friend! See man cron(8) for details on that...
If it isn't any of those, try looking in your logs. I believe cron has
its own log file; check the cron(8) manpage to see what it is on your
system. As always when troubleshooting a problem, check the system logs
too. Might turn something up.
--
"Quis custodiet ipsos custodes?" "Who watches the watchmen?"
-Juvenal, Satires, VI, 347
Derek D. Martin | Senior UNIX Systems/Network Administrator
Arris Interactive | A Nortel Company
derekm at mediaone.net | dmartin at ne.arris-i.com
-------------------------------------------------
-
Subcription/unsubscription/info requests: send e-mail with
"subscribe", "unsubscribe", or "info" on the first line of the
message body to discuss-request at blu.org (Subject line is ignored).
More information about the Discuss
mailing list