Skip to content

Instantly share code, notes, and snippets.

@sabl0r
Created January 2, 2021 11:17
Show Gist options
  • Select an option

  • Save sabl0r/706cf23175d0015d7f0489b791c3025d to your computer and use it in GitHub Desktop.

Select an option

Save sabl0r/706cf23175d0015d7f0489b791c3025d to your computer and use it in GitHub Desktop.
Synology NAS cronjob mailer
#!/usr/bin/env php74
<?php
define('TO', '[email protected]');
define('FROM', '[email protected]');
$stdIn = trim(stream_get_contents(STDIN));
if($stdIn === ''){
exit(0);
}
$subject = $argv[1];
mail(TO, '[NAS] '.$subject, $stdIn, [
'From' => FROM
]);
@sabl0r
Copy link
Author

sabl0r commented Jan 2, 2021

Use in /etc/crontab like this:

0 2 * * * sabl0r /volume1/homes/sabl0r/adm/backup.sh 2> /dev/stdout 1> /dev/null | /volume1/homes/sabl0r/adm/mailer.php "Backup NAS"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment