SHC Cron help-me

Hello, I have some shellscripts internal company more by the need to conceal the code to protect passwords and others, we are using the SHC.

the shellscripts always worked without error, including cron.

after the SHC, if I run manually ( . / shellscript ) it works

if I put the same command to run in cron , hours works sometimes not.

only in cron does not work ...
already put in / usr / bin / run straight to the command still does not work ... anyone ever had a problem with the SHC? There is another that you can use instead of the SHC?

I'm sure that is not the shell script because without encrypting it runs without errors.

Use the following steps to encrypt.

shc -r -f 

Very thanks!

You need to specify the full path in a crontab

15 23 * * 1,2,3  /path/to/compiled/shellscript

And it should never be placed in /usr/bin

If this does not help, please post

  1. the exact error you are getting
  2. your OS
  3. your crontab entry
crontab -l

will give you a listing of your crontab file

my cron

*/5 * * * * /usr/bin/myshell.x

OS CentOS 6.2

I'll change the folder, something specific? it runs well straight or should I access the folder and run with. / ?

*/5 * * * * cd /xx/xxx/;   ./myshell.x

?

Thanks

What Jim said was that you should not put a script which is intended to be executed only by root in /usr/bin. You may place the file somewhere safer, e.g /root/bin etc. I always place the cron scripts in /root/cron directory.

Anyway, please check /var/log/cron file for the error message as to why the script is not getting executed.

Most problems occur due to the PATH environment variable being not set explicitly in the script. It should work in a bash session, but not while executing through cron as it does not set PATH if not explicitly done so in the script.

1 Like