I cannot for the life of me figure out why this isn't working. All versions of this script work fine when I run it manually, BUT when it is executed via crontab or cron.hourly it cannot append to a file. The "endlines" append, but the text does not.
Permissions are 777 on everything. I've tried using both root and my own username.... anyone have any ideas?
Using CentOS 6.2
Permissions are 777 on everything. I've tried using both root and my own username.... anyone have any ideas?
Using CentOS 6.2
Code:
[root@localhost ccticker]# cat ccticker.sh
#!/bin/bash
/usr/bin/curl https://btc-e.com/api/2/ltc_usd/ticker >> ltc.txt
echo \ >> /home/root/ccticker/ltc.txt
Code:
[root@localhost ccticker]# cat ccticker2.sh
#!/bin/bash
wget https://btc-e.com/api/2/ltc_usd/ticker
cat /home/root/ccticker/ticker >> /home/root/ccticker/ltc.txt
echo \ >> /home/root/ccticker/ltc.txt
rm -f /home/root/ccticker/ticker
Code:
[root@localhost ccticker]# ll
total 16
-rwxrwxrwx. 1 root root 192 Jul 21 14:26 ccticker2.sh
-rwxrwxrwx. 1 root root 131 Jul 21 14:46 ccticker.sh
-rwxr-xr-x. 1 root root 114 Jul 14 23:26 ccticker.sh.backup
-rwxrwxrwx. 1 root root 26 Jul 21 14:52 ltc.txt
Code:
[root@localhost ccticker]# cat /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=
HOME=/
# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
*/2 * * * * root ./home/root/ccticker/ccticker.sh
*/2 * * * * root ./home/root/ccticker/ccticker2.sh