If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > How to change the invoking shell for CRON (from sh to csh) ?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-21-05, 09:18
borsotti borsotti is offline
Registered User
 
Join Date: Jan 2005
Posts: 7
How to change the invoking shell for CRON (from sh to csh) ?

Hi all,

I need to make cron process use csh instead of standard sh when invoking a crontab entry.

Cron process uses sh:

mxtest 7299 566 0 14:46:00 ? 0:00 sh -c $HOME/mytest.csh
mxtest 7300 7299 12 14:46:00 ? 19:28 /bin/csh -f /export/home1/mxtest/mytest.cs

I added "SHELL=/bin/csh/ in /etc/default/cron but no effect...

Thks a lot,
Marco
Reply With Quote
  #2 (permalink)  
Old 01-21-05, 09:58
vgersh99 vgersh99 is offline
Registered User
 
Join Date: Apr 2004
Location: Boston, MA
Posts: 325
would it it be more natural to specify the shell interperter to INSIDE any of your csh scripts?

like so for 'mytest.sh':
#!/bin/csh
echo "here's my ${0}"
__________________
vlad
+-----------------------+
| #include <disclaimer.h> |
+-----------------------+
Reply With Quote
  #3 (permalink)  
Old 01-24-05, 09:28
borsotti borsotti is offline
Registered User
 
Join Date: Jan 2005
Posts: 7
Unluckly no: in my scripts I'm already specifying what you suggest, so the executing shell is csh, but the involking shell (parent) is sh if run from crontab.

This is what I want to avoid...

sh =>
mxtest 27109 4054 0 15:26:00 ? 0:00 sh -c csh -c "$HOME/prova.csh"

csh =>
mxtest 27110 27109 0 15:26:00 ? 0:00 csh -c /export/home1/mxtest/prova.csh

csh =>
mxtest 27115 27110 4 15:26:00 ? 0:03 /bin/csh -f /export/home1/mxtest/prova.csh





Thks,
Marco
Reply With Quote
  #4 (permalink)  
Old 01-24-05, 13:24
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,456
Cool

Set default shell in /etc/passwd like:

myid:x:222:66:My User Id:/home/MyHome:/bin/csh

Or, make first statement in "$HOME/prova.csh" to be: #!/bin/csh and in crontab invoke like this:

00 01 * * * /home/MyHome/prova.csh

__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

Last edited by LKBrwn_DBA; 01-24-05 at 13:30.
Reply With Quote
  #5 (permalink)  
Old 01-24-05, 13:41
vgersh99 vgersh99 is offline
Registered User
 
Join Date: Apr 2004
Location: Boston, MA
Posts: 325
'man crontab'

Quote:
The shell is invoked from your $HOME directory with an arg0
of sh.
__________________
vlad
+-----------------------+
| #include <disclaimer.h> |
+-----------------------+
Reply With Quote
  #6 (permalink)  
Old 01-25-05, 08:43
borsotti borsotti is offline
Registered User
 
Join Date: Jan 2005
Posts: 7
This Answers

crontab man page answers my question

thks

Marco
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On