Got a cron to run everyday under my user. this cronjob runs a script from my /home/jack/scripts/run.sh
Code:
clear
#
# su to root and run a script, return with result
# su -
# passwd
# run /getfile.sh
# return with result
# the result will copy 2 files from /prod/app/logs/ and throws to my /home/jack/scripts/file1.txt and file2.txt
#
awk -F" " '$5==0 && $3=="ServerA"{print $1}' file1.txt file2.txt | sort -r | head -1 > output.txt
uuencode output.txt output.txt | mailx -s "Todays Server ErrorLog Reprot" xxx@xxx.com
I am having the root password. Need to know how to su from normal user, run script which has root privileges, logout from user with result to my user and continue the next sequence of my script.
All the above steps inside # remark statements needs proper code.
Thanks in advance
Recent comments
11 hours 34 min ago
16 hours 39 min ago
21 hours 3 min ago
22 hours 52 min ago
1 day 13 hours ago
1 day 13 hours ago
1 day 18 hours ago
2 days 47 min ago
2 days 1 hour ago
2 days 2 hours ago