|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
passing argument in cron job
I am new to cron, and need some advice. I currently have a shell script which runs like the example shown below. There are 4 of these duplicates I want to run. But I want to pass an arguement so that it changes to a different user-id within the script
0,5,10,15,20,25,30,35,40,45,50,55 ***** /../../../test.sh 2 [want to add an argument here for example $userid=xyz] >&1. Now in this shell script there is a variable which needs to be changed when the cron job runs. Example in shells script: $user-id = (this needs to be defined from the cron job) Can anyone help with this. |
|
#2
|
|||
|
|||
|
yes you need advice.
this is wrong: 0,5,10,15,20,25,30,35,40,45,50,55 ***** see man pages crontab this is not really intelligent 0,5,10,15,20,25,30,35,40,45,50,55 and this is inpossible /../../../test.sh |
|
#3
|
|||
|
|||
|
First never use relative paths in cron jobs i.e. /../../../test.sh
Always provide the full path i.e. /home/fpm/test.sh Second, you can pass arguments to test.sh but it is up to test.sh to interpret them as command line arguments. Form a typical crontab(5) manpage .... The ``sixth'' field (the rest of the line) specifies the command to be run. The entire command portion of the line, up to a newline or % character, will be executed by /bin/sh or by the shell specified in the SHELL variable of the cronfile. Percent-signs (%) in the command, unless escaped with backslash (\), will be changed into newline characters, and all data after the first % will be sent to the command as standard input. |
|
#4
|
|||
|
|||
|
fpmurphy:
First never use relative paths in cron jobs i.e. /../../../test.sh is that a relative path ? IMO it's very absolute pointing to an absolutely impossible path |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > passing argument in cron job |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|