I have a file in cron.daily:

root@nagios.example.com:/# cat /etc/cron.daily/nagios-logs
/usr/bin/nice -n 19 /bin/gzip --fast /var/log/nagios3/archives/*
root@nagios.example.com:/# ls -l /etc/cron.daily/nagios-logs
-rwxr-xr-x 1 root root 65 Apr 15 17:51 /etc/cron.daily/nagios-logs

but it's not doing anything. Any ideas why?

  • How did you know it is not executing? Did you try it manually?
    – Khaled
    Apr 17, 2013 at 9:38
  • @Khaled It does not compress uncompressed files in /var/log/nagios3/archives/. When I execute it manually it works.
    – Poma
    Apr 17, 2013 at 9:39
  • Why not have it in a script? That way you define the shell..
    – NickW
    Apr 17, 2013 at 9:51
  • Did you try appending >> /tmp/file.log 2>&1 to see if there is any debug/error?
    – Khaled
    Apr 17, 2013 at 9:52
  • @NickW the output of cat command is full and not edited
    – Poma
    Apr 17, 2013 at 9:54

1 Answer 1


Your file /etc/cron.daily/nagios-logs is neither a program nor an executable script. You can make it a shell script by adding #!/bin/sh to the beginning of the file

/usr/bin/nice -n 19 /bin/gzip --fast /var/log/nagios3/archives/*

The shell script also needs to be executable

root@nagios.example.com:/# chmod 755 /etc/cron.daily/nagios-logs

but I see from the output of your ls -l command that your file already has the correct file permissions

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.