Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jeansymolanza/fc71f2db94b54aab8a3e0268d5deb7e7 to your computer and use it in GitHub Desktop.
Save jeansymolanza/fc71f2db94b54aab8a3e0268d5deb7e7 to your computer and use it in GitHub Desktop.
// ...
while (!stop_requested) {
if (access(STOP_FILE, F_OK) != -1) {
// Stop file exists
printf("Stop file found at %s. Deleting the file and stopping the script.\n", STOP_FILE);
// Delete the stop file
if (remove(STOP_FILE) == 0) {
printf("Stop file deleted successfully.\n");
} else {
fprintf(stderr, "Failed to delete stop file: %s\n", strerror(errno));
}
// Exit the loop
break;
}
// ... (rest of the code remains the same)
}
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment