Re: change shell type in crontab

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You just answered your own question. sh is a link. it's the same as bash. remove the bash -login and make sure the file is executable.
Use -n to check your syntax. This is from the bash man page.
-n Read commands but do not execute them. This may be used to check a shell script for
syntax errors. This is ignored by interactive shells.


diego.veiga@xxxxxxxxxxxxxx wrote:




The big problems is this.


i have this script:
--------------------->
#!/bin/bash
##########################################################################################
# program : _tools/sys_backup_pc08spt.bash
#
# subject : cria um arquivo de backup de todo o portal e transfere para a
maquina pc08spt#
##########################################################################################
. /home/rphp/.bash_profile
/app/portal_spt/htdocs/_tools/sys_funcs.bash
and go one...
--------------------->

the crontab line is this:
3 5 * * 1-6 `bash -login
/app/portal_spt/htdocs/_tools/sys_backup_samba.bash`

but after run the crontab i see in maillog this message:

/bin/sh: changed: command not found

the /bin/sh is a link to the /bin/bash
why the crontab is trying to run the script in sh...?

diego


----- Message from Cameron Simpson <cs@xxxxxxxxxx> on Fri, 31 Oct 2003
15:52:38 +1100 -----
To: redhat-list@xxxxxxxxxx Subject: Re: change shell type in crontab


On 09:04 30 Oct 2003, diego.veiga@xxxxxxxxxxxxxx
<diego.veiga@xxxxxxxxxxxxxx> wrote:
| I would like to change the shell to execute the crontab (all the programs
| to execute are bash).
|
| the file /etc/crontab is:
| SHELL=/bin/bash
| PATH=/sbin:/bin:/usr/sbin:/usr/bin
| MAILTO=root
| HOME=/ ...
|
| But i?m receiving email with the crontab variable:
|
| X-Cron-Env: <LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH>
| X-Cron-Env: <SHELL=/bin/sh>
| X-Cron-Env: <HOME=/root>
| X-Cron-Env: <PATH=/usr/bin:/bin>
| X-Cron-Env: <LOGNAME=root>
| Status: RO
|
| /bin/sh: changed: command not found

Are you sure you've posted the complete crontab?

Anyway, if all the commands are separate scripts and each script starts
with:

#!/bin/bash

then the Right Thing should happen anyway.

I do wonder what you're doing that needs bash though...
--
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/

The Fano Factor, where theory meets reality.



Diego Brito Veiga
Technical Publications
Phone: +55 (12) 39278368
Fax: +55 (12) 39273342






--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux