Finger
[ Catch22 | maharG | DeadBeef | Kismet | Display Lines | Search ]
Login: lincoln Name: Lincoln Reid
Directory: /home/lincoln Shell: /bin/bash
On since Tue Nov 13 16:59 (NZDT) on pts/1 from vlan102.guard-dog.acsdata.co.nz
13 hours 43 minutes idle
On since Tue Nov 13 17:01 (NZDT) on pts/3 from vlan102.guard-dog.acsdata.co.nz
13 hours 42 minutes idle
No mail.
No project.

.plan:

When your scripts don't work from cron - Wednesday, 12th September 2018
-----------------------------------------------------------------------

If you've ever had a script that runs fine when you execute it from your regular login shell but won't work from your crontab you may be running into differences between the environment variables that are setup by cron and the environment that a full login shell gets.



If you want to debug this it might be handy to be able to execute a shell with the same environment that cron uses.



You can dump the cron environment to a file by adding a crontab entry to execute env:



So, crontab -e and add this:



* * * * * /usr/bin/env > ~/cronenvironment



Once ~/cronenvironment is populated you can execute a shell using it:



env - `cat ~/cronenvironment` /bin/sh



Then debug away.