- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- problem in crontab execution
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2004 12:19 AM
06-29-2004 12:19 AM
i have a problem in executing crontab.
i need to set value for a variable before executing my command in crontab. i did the following in a seperate file (setenv.sh) to do the same. Content of the file (setenv.sh) is as follows
#!/bin/sh
export SW_PLATFORM=sol
my crontab will execute this file (setenv.sh) first and then exectue my command which use this variable to execute. But when i execute the command, value of SW_PLATFORM is blank. I also tried to print the value in my crontab. It also printed blank.
How do i set the value of this variable so as my command can able to access the same ?
my crontab looks like this
25 17 * * * echo $PATH 1>/dev/pts/52
25 17 * * * /export/home/dawood/setenv.sh 1>/dev/pts/52
25 17 * * * echo $SW_PLATFORM 1>/dev/pts/52
25 17 * * * /opt/softwire/develop/scripts/sw_admin runregression -proj cartridges -file cartridges/release/generic/scripts/sw_night -m -f -s[cartridges]soapSL.deps
Thanks for the help.
Dawood
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2004 12:22 AM
06-29-2004 12:22 AM
Re: problem in crontab execution
25 17 * * * ( export SW_PLATFORM=sol ; /opt/softwire/develop/scripts/sw_admin runregression -proj cartridges -file cartridges/release/generic/scripts/sw_night -m -f -s[cartridges]soapSL.deps )
or
25 17 * * * ( . /export/home/dawood/setenv.sh ; /opt/softwire/develop/scripts/sw_admin runregression -proj cartridges -file cartridges/release/generic/scripts/sw_night -m -f -s[cartridges]soapSL.deps )
Either of those should achieve what you require.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2004 12:23 AM
06-29-2004 12:23 AM
Re: problem in crontab execution
Did you execute your setenv.sh using dot?
I would...
. setenv.sh
Now it should work...
All the best
Victor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2004 12:31 AM
06-29-2004 12:31 AM
Re: problem in crontab execution
I doubt you finding an easy solution...
Good luck
Victor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2004 12:37 AM
06-29-2004 12:37 AM
Solutionecho $PATH 1>/dev/pts/52
/export/home/dawood/setenv.sh 1>/dev/pts/52
echo $SW_PLATFORM 1>/dev/pts/52
/opt/softwire/develop/scripts/sw_admin runregression -proj cartridges -file cartridges/release/generic/scripts/sw_night -m -f -s[cartridges]soapSL.deps
And put it in a single script...then call that script from cron....
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2004 12:42 AM
06-29-2004 12:42 AM
Re: problem in crontab execution
If you want to set a variable that will be used by a job
Then my first reply applies or you can put the lot in the same script
the script would look like:
#!/bin/sh
export SW_PLATFORM=sol
export PATH=
echo $PATH 1>/dev/pts/52
echo "SET_PLATFORM: " $SW_PLATFORM 1>/dev/pts/52
/opt/softwire/develop/scripts/sw_admin runregression -proj cartridges -file cartridges/release/generic/scripts/sw_night -m -f -s[cartridges]soapSL.deps
#end
All the best
Victor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2004 12:52 AM
06-29-2004 12:52 AM
Re: problem in crontab execution
---------------------------------------------
Your "cron" job on antriksh
(export SW_PLATFORM=sol;echo $SW_PLATFORM 1>/dev/pts/52;/opt/softwire/develop/scripts/sw_admin runregression -proj cartridges -file cartridges/release/generic/scripts/sw_night -m -f -s[psi_cartridges]soapSL.deps)
produced the following output:
sh: SW_PLATFORM=sol: is not an identifier
---------------------------------------------
is there any other way ?
Thanks
Dawood
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2004 12:59 AM
06-29-2004 12:59 AM
Re: problem in crontab execution
* * * * * (export SW_PLATFORM=sol;echo $SW_PLATFORM)
That should work fine (I have tested this). If that works, then the problem must lie in some way with the actual sw_admin command you are running. Unfortunately without knowing what/how this is supposed to work I don't know what to suggest. Only thing, perhaps your [ ] brackets are causing confusion in some way. Is the format of that command definately correct?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2004 05:28 PM
06-29-2004 05:28 PM
Re: problem in crontab execution
It worked. I moved all my commands into one script and executed at one stretch.
Thanks again for your time.
Dawood
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2004 05:40 PM
06-29-2004 05:40 PM
Re: problem in crontab execution
What about assigning some points to the people, that helped yu solve your problems ?
Rgds
Alexander M. Ermes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2004 11:48 PM
06-29-2004 11:48 PM
Re: problem in crontab execution
I have already assigned points to the responders.
Thanks,
Dawood