0

I'm currently on Linux Ubuntu 14.04 (I think).

So I previously had a cron.daily script which was working fine. I decided to use the same script but move it to cron.hourly and now it wont work.

/etc/cron.hourly/dstealth-watch-tv

#!/bin/bash

times=$(date)
echo "${times}:" >> /var/log/dstealth/watch-tv.log
/usr/bin/curl --silent http://watch.dstealth.com/tv/refreshToken.php?k=secretRefreshKey >> /var/log/dstealth/watch-tv.log

I've given the file CHMOD: 755

The log file was created manually with CHMOD: 644 and is empty.

Then I used:

service cron reload

and waited several hours hoping for an output into my log file but it remains empty.

I've tried

run-parts --verbose /etc/cron.hourly

and this is the output I get:

/etc/cron.hourly/dstealth-watch-tv:
run-parts: failed to exec /etc/cron.hourly/dstealth-watch-tv: No such file or directory
run-parts: /etc/cron.hourly/dstealth-watch-tv exited with return code 1

This also did not result in anything being input into the log file.

  • 2
    You created the script file on a Windows machine? – roaima Jun 8 '17 at 13:55
  • I created it on NPP through NppFTP directly onto the server. It's owner is root as are the rest of my scripts – Dal Jun 8 '17 at 13:58
  • Ah. So you did create it on Windows. – roaima Jun 8 '17 at 13:59
  • does that effect something? – Dal Jun 8 '17 at 14:01
  • @Dal Yes. It puts carriage returns at the end of each line. – Kusalananda Jun 8 '17 at 14:11
3

Run this command to convert the file from Windows format to UNIX/Linux format.

dos2unix /etc/cron.hourly/dstealth-watch-tv
  • alright cool, now to wait an hour or so to see if it works – Dal Jun 8 '17 at 14:02
  • I just ran: run-parts --verbose /etc/cron.hourly and it ran smoothly. Output file has successful output. Thank you!!! – Dal Jun 8 '17 at 14:04
  • @Dal If this answer solved your issue, please take a moment and accept it by clicking on the check mark to the left. That will mark the question as answered and is the way thanks are expressed on the Stack Exchange sites. – terdon Jun 8 '17 at 14:16
  • I tried but it said I had to wait 5 minutes to accept it lol. don't worry I was comin back to do it :) – Dal Jun 8 '17 at 14:21
  • @Dal next time you use NPP toggle the setting that asks whether to transfer in binary or text mode (there will be one, I'm sure) and flip it across to text mode. It might reference line endings. You need LF rather than CR/LF. – roaima Jun 8 '17 at 14:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.