FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 07-12-2011, 10:41 PM
Markus Schönhaber
 
Default Error when running a script with cron.

13.07.2011 00:02, Wipe_Out:

> I have written a basic bash script to stop and restart xinetd as part of a
> cleanup routine for a server we run.. When run from a prompt it runs
> perfectly.. I have scheduled it to run every night as a cron job and every
> night I get an email with the following error..
>
> /etc/init.d/xinetd: 75: start-stop-daemon: not found
> /etc/init.d/xinetd: 75: start-stop-daemon: not found
>
> I can't figure out why..
>
> Can anyone give me any ideas??

Yes. The environment of a script run by cron is much different of the
environment of a script run from the prompt. Especially, by default,
cron sets
PATH=/usr/bin:/bin
but start-stop-deamon sits in /sbin.

So, in your script, you'll have to explicitly set PATH the way you need it.

--
Regards
mks

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 07-13-2011, 08:12 AM
Wipe_Out
 
Default Error when running a script with cron.

2011/7/12 Markus Schönhaber <ubuntu-users@list-post.mks-mail.de>

13.07.2011 00:02, Wipe_Out:



> I have written a basic bash script to stop and restart xinetd as part of a

> cleanup routine for a server we run.. When run from a prompt it runs

> perfectly.. I have scheduled it to run every night as a cron job and every

> night I get an email with the following error..

>

> /etc/init.d/xinetd: 75: start-stop-daemon: not found

> /etc/init.d/xinetd: 75: start-stop-daemon: not found

>

> I can't figure out why..

>

> Can anyone give me any ideas??



Yes. The environment of a script run by cron is much different of the

environment of a script run from the prompt. Especially, by default,

cron sets

PATH=/usr/bin:/bin

but start-stop-deamon sits in /sbin.



So, in your script, you'll have to explicitly set PATH the way you need it.



--

Regards

*mks



Great.. Thanks.. I have set the PATH so will see tonight if all goes smoothly..
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 

Thread Tools




All times are GMT. The time now is 09:20 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org