I have created a script to run tshark to get a packet capture periodically during the day on a REDHAT server. If I run the shell script under either "root" or another user id (MANUALLY) it works and writes to the files i've created. But if I let cron run the shell script, everything works except the " tshark -i eth1 -c # -w /tmp/BUILD ". I have tried changing permission on script, created files, binary file,... but nothing seems to allow tshark to run if script is executed via cron. I also followed link text for TCPDUMP and WIRESHARK and neither have worked... Any suggestions?? I know it is permissions related somewhere. should I make some kind of "cron" user id or group the owner of the script or tshark binary? Thanks!!!! asked 21 Mar '16, 09:44 msmorten |
One Answer:
If the script runs successfully when ran manually from any user, it is not likely to be an issue of rights - a crontab is normally defined for a particular user and executes the commands with privileges of that user. I expect that your problem is that cron does not set the environment variables, including path. Therefore, you have to use absolute paths to the executables in the scripts started by cron. So instead of just answered 21 Mar '16, 14:19 sindy |
This makes sooo much sense and I will let you know the results once I test this.
Thank you!!!
Absolutely worked