I've just set-up one cron-job in cpanel, but although it seems to be executing the script it doesn't work as intended.
Here is the cron job command in cpanel:
/bin/sh /home/my-username/cronjobs/sedclearmalw.sh
and here is the content of the script :
#!/bin/bash
cd ../public_html/
grep -rl '_0xaae8' . | xargs sed -i 's/var\s_0xaae8.*//g'
I believe the cd command should be correct, as it needs to go back a directory and then enter public_html, however the second command seems to be the problem. I have tried running it via ssh, (bash sedclearmalw.sh) it seems like it's running for ~15 seconds but it's not doing its job , as i checked with the following command :
grep -rl '_0xaae8'
and it returns 1 file containing _0xaae8. Any help will be appreciated, it must be something simple as i know the above command in the shell script works all right when executed via ssh (not through the script).
cd
in the first line. The time taken is high because you are usinggrep -rl
and the default cron job directory could be/
, and hence it is searching everywhere.cd ../public_html
failed. - hence it is not finding anything.-i
option insed
is where the action happens.