# Windows Share Dr alias share='cd $SHARE' sudo mount.vboxsf share ~/share export SHARE=~/share/
$ which python /usr/bin/python
http://qiita.com/gano/items/802519add83c524e3019
テストスクリプト crontest.py
# -*- coding: utf-8 -*- import sys with open("hoge.txt", "w") as f: f.write("hello python") f.write(str(sys.version))
crontab -e (編集) crontab -r (リセットされる)
crontab -l > ~/crontab #バックアップ vim ~/crontab #バックアップを編集 crontab < ~/crontab #本体に上書き
* * * * * /<path_to_python>/python3 /<path_to_file>/test.py * * * * * <path_to_python>/python3 /<path_to_file/test.py >> /<path_to_log>/test.log 2>>&1
※ python path which python3
chmod 700 test.py chown root:root test.py
(CRON) info (No MTA installed, discarding output) 解決 $ sudo apt-get install postfix
sudo service cron status sudo service cron start sudo service cron start
/var/log/syslog
/etc/cron.d/usercron
# /etc/cron.d/usercron SHELL=/bin/bash PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin HOME=/home/fifi # m h dom mon dow user command # * * * * * root $HOME/anaconda3/bin/python $HOME/cron-script/crontest/crontest.py # */1 * * * * root $SHELL $HOME/cron-script/crontest/crontest.sh # TEST SCRIPT CRONSCRIPT = /home/fifi/cron-script/crontest CLOG = /home/fifi/cron-script/crontest/log */1 * * * * root which python >> $CLOG/whichpython.log */1 * * * * root echo "echo log" >> $CLOG/cron-echo.log */1 * * * * root python $CRONSCRIPT/crontest.sh