I have to several times debug scripts that I get complain about working when logging in normally but they do not work when run in cron mode. So, quite a lot of times, redirecting the stderr of the script is all that is required to see what is happening, but sometimes that just does not help if the script is calling another script which is mis-behaving and under lot of other conditions. So, how to at-least take a look at why these are failing, login with ssh.
Use the “noprofile” option to ensure that user profile settings are not sourced and you should be good to test. (Do not try to do this with “user#localhost”, as by that time you would have already sourced the profile.)
ssh -t user@server "bash --noprofile"
Now, if you want to run bash like this, then you need a terminal, and thus dont forget the “-t” option as well.
- 2010/05/24 Menu driven ssh.
- 2013/01/01 poor mans watch, watch for solaris
- 2011/05/16 Unix shell script for removing duplicate files
- 2011/05/14 Terminating a SSH session after starting background process.
- 2011/01/25 shopt causes bash completion to stop working.