Skip to content

Instantly share code, notes, and snippets.

@vol4ok
Created February 10, 2012 06:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vol4ok/1787244 to your computer and use it in GitHub Desktop.
Save vol4ok/1787244 to your computer and use it in GitHub Desktop.
restart root nginx
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
int main(void)
{
int result;
setuid( 0 );
result = system("/bin/bash -c 'kill -HUP `cat /usr/local/var/run/nginx.pid`'");
if (result == 0)
printf("OK!\n");
else
printf("FAIL!\n");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment