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

Popular posts from this blog

c++ - OpenMP unpredictable overhead -

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

javascript - Wordpress slider, not displayed 100% width -