I'm trying to do something with a cron wrapper and my cron looks something like
* * * * * root /usr/bin/wrapper cd /tmp/ && ls
Then wrapper looks like
When I run it I can't get the semi colon or && to work as I'm hoping.
[email@example.com ~/test]# pwd /root/test [firstname.lastname@example.org ~/test]# ls test.sh [email@example.com ~/test]# ./test.sh cd /tmp && ls test.sh
So in that case it goes into tmp then the weapper script exits.. and it runs ls in my cwd.
If I add '' around the command I get
[firstname.lastname@example.org ~/test]# ./test.sh 'cd /tmp && ls' ./test.sh: line 3: cd /tmp && ls: No such file or directory
I'm guessing with the "$@" it is trying to add in the single quote to the command being run
I support I can strip out the single quotes before the "$@" but I was hoping not to do that.. any tips or is this even solvable in bash?