crontab run shell script that write user history into a log file -
i write following shell script:
#!/bin/bash histfile=~/.bash_history set -o history file=$(date "+%y_%m_%d_%h_%m_%s").txt history  > /home/sandipon/$file cat  /home/user/$file sshpass -p my_password scp  /home/user/$file host:/home/test/$file   and scheduled cron:
*/2 * * * *  /home/user/history.sh   but provides blank file.
comment fedorqui correct. also, shoud add username in crontab file (if use "/etc/crontab").
 example:
*/2 * * * *  username  /bin/bash /home/user/history.sh      
Comments
Post a Comment