Also keep in mind, that a variable is only visibile in the current environment (not children of an executed process), unless the variable
is "exported" (with export VARIABLE=...)
export PATH=/patha:/pathb...
Mar 7 15:21:01 orac CRON[25958]: (avon) CMD (/hub/bats/fsxinfo.sh)
Mar 7 15:21:01 orac CRON[25957]: (CRON) info (No MTA installed, discarding output)
Is that latter line an issue that could cause the script not to run?
Mar 7 15:21:01 orac CRON[25957]: (CRON) info (No MTA installed, discarding output)
Is that latter line an issue that could cause the script not to run?
Where do I go to check the logs that things are running?
30 14 * * sun /hub/bats/fsxinfo.sh
Where do I go to check the logs that things are running?
I don't think my cron jobs for nodelist and infopack creation are running as intended.
I just added this last line to test and nothing seemed to happen either.
I had previously used numbers for dow so 4 and 5 for thu and fri respectively
# m h dom mon dow command
0 0 * * * /hub/bats/logbackup.sh
15 2 * * thu /hub/bats/make-region57.sh
15 2 * * fri /hub/bats/fsxnode.sh
20 2 * * fri /hub/bats/fsxinfo.sh
30 14 * * sun /hub/bats/fsxinfo.sh
Keep in mind that the environment cron runs in is almost bald. There is
no path in the environment unless you put it there in the script.
Looks like you need zip for those so use the full path /usr/bin/zip, or add a path in those scripts before you get started.
Looks like you need zip for those so use the full path /usr/bin/zip, or
add a path in those scripts before you get started.
I guess it could be a pathing issue in the script.
I note when it runs the script I see
Mar 7 15:21:01 orac CRON[25958]: (avon) CMD (/hub/bats/fsxinfo.sh)
Mar 7 15:21:01 orac CRON[25957]: (CRON) info (No MTA installed, discarding output)
Is that latter line an issue that could cause the script not to run?
If the commands in your script need a path I'd add a line like this to
the beginning of the script to source a file with your path.
. /etc/profile <- or whereever your path is set, works with slackware.
. /home/avon/.bash_profile <- Works on debian?
I note when it runs the script I see
Mar 7 15:21:01 orac CRON[25958]: (avon) CMD (/hub/bats/fsxinfo.sh)
Mar 7 15:21:01 orac CRON[25957]: (CRON) info (No MTA installed, discarding output)
Is that latter line an issue that could cause the script not to run?
Is that latter line an issue that could cause the script not to run?
Not necessarily.
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/avon/b
ts
This at least got the first line of my script running when started by CRON so that's progress.
Can't see a bash_profile in my home dir, did see a /etc/profile file... but if the PATH I set above works will that do?
Looks like you need zip for those so use the full path /usr/bin/zip, or >> add a path in those scripts before you get started.I guess it could be a pathing issue in the script.
If the commands in your script need a path I'd add a line like this to
the beginning of the script to source a file with your path.
. /etc/profile <- or whereever your path is set, works with slackware.
I feel I am playing whack a mole trying to get lines in my script to run.
zip seemed to run but scp did not what is the best way to ensure these programs like htick, scp, etc. run when called by cron?
That's a cron thing. Cron has a very limited environment by default. Either use full paths or add the needed environment to scripts being run from cron.
zip seemed to run but scp did not what is the best way to ensure these programs like htick, scp, etc. run when called by cron?
Use a full path to scp. On my slackware box it is /usr/bin/scp.
When I run hpt from cron I start it with /usr/local/bin/hpt. hpt doesn't need an environment because it has the full path to zip and unzip in
it's config.
. /etc/profile <- or whereever your path is set, works with slackware.
What is the syntax to use?
PATH=/etc/profile
Would that be enough to cover the assorted tools I am trying to run from my scripts?
Getting a nodelist and infopack out with Windows was never this hard :(
I think I've managed to get the infopack script to finally run as intended but ended up adding more stuff to the scripts PATH statement.
That said I think perhaps the way to go would be to explicitly state full paths to the executable files... what a total phaff :)
Thanks for your help. I'm going to take a break and do some dinner before I try to tackle the nodelist script
zip seemed to run but scp did not what is the best way to ensure these programs like htick, scp, etc. run when called by cron?
zip seemed to run but scp did not what is the best way to ensure these programs like htick, scp, etc. run when called by cron?
start Mar 7 14:30:07 orac CRON[22725]: (CRON) info (No MTA installed, discarding output)
Looks like it ran... I'll keep digging it could be my script that's duff still.
Sourcing /etc/profile should also work but it would include other stuff that might not be needed. And sourcing a bash_profile from the home directory of some user would work but I would not recommend it as it would mish-mash stuff from users and the system, which is not a clean solution.
Sourcing /etc/profile should also work but it would include other stu that might not be needed. And sourcing a bash_profile from the homeSourcing your own .bash_profile (if you have one, I don't) will result
in cron having the usual user environment, if that is what you want.
Cron runs on faith!
Ahh the old question .bashrc or .bash_profile (but not quite)
OUTSIDE OF CRON ...
.bash_profile is used for login shells. .bashrc is used for shells that are both interactive and non-login
Cron runs on faith!
That and perserverance or frustration.
Sysop: | Gary Ailes |
---|---|
Location: | Pittsburgh, PA |
Users: | 132 |
Nodes: | 5 (0 / 5) |
Uptime: | 109:31:32 |
Calls: | 733 |
Files: | 2,171 |
Messages: | 81,483 |