Search This Blog

C Program to Schedule a Shutdown - How to Schedule Shutdown in C

You can schedule shutdown in Windows or Linux using C program. We will see how to schedule a shutdown using a c program. To schedule a shutdown in Windows, we execute the Windows command shutdown /s /t sec (where sec is time delay before shutdown in seconds). In Linux, we execute the command shutdown -h +600.  The c programs to schedule a shutdown in Windows and Linux are given separately.

C Program to Schedule Shutdown in Windows

//for Windows
#include<stdio.h>
void main()
{
system("shutdown /s /t 600");
//600 sec= 10 min
}


C Program to Schedule Shutdown in Linux

//for linux
#include<stdio.h>
void main()
{
system("shutdown -h +600");
//600 sec= 10 min
}

No comments: