- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: crontab
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
10-24-2003 03:09 AM
10-24-2003 03:09 AM
crontab
I have scheduled a job into the cronfile:
54 05 * * 0,1,2,3,4,5 /QA/QA/JOB/manudt.sh >/QA/QA/JOB/manudt.out 2>&1
the result is:
$ cat manudt.out
/QA/QA/JOB
Not a terminal
stty: : Not a typewriter
stty: : Not a typewriter
/QA/QA/JOB/manudt.sh[5]: COBDIR: Parameter not set.
logout
======================
The job is :
. /QA/QA/JOB/.profile
echo $HOME
echo $COBDIR
$MPE_ROOT/$SS_HOME/OGG/UTMANUDT
If I run the job manually it works, the log is:
$ cat manudt.out
/QA/QA/PUB
Not a terminal
/QA/QA/PUB
/opt/lib/cobol
logout
Why using crontab the .profile seems to be not loaded ?
How can I include .profile directly on the crontab command line and so remove .profile in the job?
From "man crontab" :
Users who desire to have their .profile executed must explicitly do so
in the crontab entry or in a script called by the entry.
Thanks
Angelo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2003 03:12 AM
10-24-2003 03:12 AM
Re: crontab
Rgds,
Jean-Luc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2003 03:14 AM
10-24-2003 03:14 AM
Re: crontab
you seems to be executing some stty commands it seems.
You can add these .profile settings to your script like
#!/usr/bin/sh
HOME=/home/user
..your script here
thanks
-Vijay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2003 03:16 AM
10-24-2003 03:16 AM
Re: crontab
-Vijay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2003 03:21 AM
10-24-2003 03:21 AM
Re: crontab
These commands are typically in your .profile, and require a terminal to be attached.
From cron, there is no terminal, hence the errors.
You can enclose the stty command(s) in an if statement, so they only get called when a terminal is attached.
Like so:
if [ -t ]
then
stty commands here
fi
-- Graham
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2003 03:22 AM
10-24-2003 03:22 AM
Re: crontab
You could just source your .profile, but you would get a lot of junk you don't need, like things are assuming you are working from a terminal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2003 03:23 AM
10-24-2003 03:23 AM
Re: crontab
Example:
env.inc
--------------
export PATH=$PATH:/usr/local/mystuff
TERM=vt100
VAR1=1024
myscript
--------------
#!/usr/bin/sh
. /home/user/jdoe/env.inc
.. the rest of your script
--Jim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2003 04:58 AM
10-24-2003 04:58 AM
Re: crontab
Always write your cron scripts to completely stand alone, that is, set $PATH explicitly (actually a good idea for all scripts), set ENV variables as needed and do not include interactive terminal commands. Unless you carefully rewrite /etc/profile and your local .profile, you will always get errors such as: not a typewriter
Bill Hassell, sysadmin