Skip to content

Instantly share code, notes, and snippets.

@HaykoKoryun
Last active August 25, 2016 14:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HaykoKoryun/a16b8aea86c726d02bd4 to your computer and use it in GitHub Desktop.
Save HaykoKoryun/a16b8aea86c726d02bd4 to your computer and use it in GitHub Desktop.
async gzip on server with email notification
<?php
$background = "> /dev/null 2>/dev/null &";
$input = "";
$output = "";
$email = "bob@bob.com";
$subject = "$output done";
$cwd = getcwd();
exec("(mail -s 'zipping up stuff in $input, will let you know when done...' $email) $background");
exec("(tar -zcvf $output $input; mail -s '$subject' $email) $background");
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment