New answers tagged


You stated your goal is to delete files older than four hours. Using bash 4.3.46 (Ubuntu 16.04) and find 4.7.0 I was able to use a find command with a decimal mtime: find /path/to/tokens/ -name "*.tkn" -mtime 0.1666666 Just convert 4/24 to decimal and there you go. You can put that in a script and perhaps pipe-rm or do a -exec rm {} \; as desired. It ...


You can use systemd. Most modern systems already use it. Use Type=Simple Type=simple (default): systemd considers the service to be started up immediately. The process must not fork. Do not use this type if other services need to be ordered on this service, unless it is socket activated. Source:


If the file exists, and the permissions are ok, then a cause can be that the file is open when you try to compress it. In order to avoid that, you can add the following line to your /etc/logrotate.conf: delaycompress


% has a special meaning in cronjobs – it means the text afterwards is given as stdin to the command before it. To use a literal percent sign, either try \escaping it or just move everything into an external script and call that from crontab. (IMHO, when it nests $(…) more than twice, it's a sure sign it should be extracted into a script.) Note that you can ...


The main difference is that your shell, when running it manually, is most likely bash, while cron defaults to sh. I cannot say for sure that this is the source of the problem, but seeing as your line is somewhat complex (as in, loads of special characters that may or may not be interpreted differently between various shells and interpreters), you might ...

Top 50 recent answers are included