linux - Deal with different directories in bash cron -
the problem...
i use trick77's ip blacklist script configure firewall of apache server , able run script in terminal.
however, when assigning bash script in ipset-blacklist crontab, not run no matter do.
code written in crontab file root:
@daily /var/bash/update-blacklist.sh what think culprit...
since haven't done sort of thing before, believe path of bash script isn't set correctly... again, i'm not sure.
i have seen others using line such path=/usr/bin:/bin:/usr/sbin:/sbin resolve problems involving script's location, but, don't know does.
i set location of bash file /var/bash instead of /usr/bin , believe throwing things off.
pardon lack of understanding. beginner when comes bash.
any appreciated.
what have done...
per @etanreisner:
added
echo here >> /tmp/update-blacklist.outtop ofupdate-blacklist.sh, set cron run every minute (* * * * *).the file created.
added
type -p curl grep egrep ipset >> /tmp/update-blacklist.outtop ofupdate-blacklist.sh, returned:
-p: not found curl /usr/bin/curl grep /bin/grep egrep /bin/egrep ipset: not found
the output type ipset indicated ipset not in cron script path isn't surprising.
the default path cron jobs limited.
with ipset located in /usr/sbin path must added cron script's path variable.
you talked in question
i have seen others using line such path=/usr/bin:/bin:/usr/sbin:/sbin resolve problems involving script's location, but, don't know does.
what set path variable paths (from whatever default value was).
the path variable contains paths shell looks binaries/scripts/etc. run when try run them commands.
Comments
Post a Comment