This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
trap control_t SIGTERM | |
function control_t() { | |
echo "SIGTERM detected" | |
echo "... Disk cleanup started ..." | |
sleep 45 | |
echo "... Disk cleanup is complete ..." | |
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
trap control_t SIGTERM | |
function control_t() { | |
echo "SIGTERM detected" | |
exit 0 | |
} | |
for i in `seq 1 86400`; do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
trap control_t SIGTERM | |
function control_t() { | |
echo "SIGTERM detected" | |
} | |
for i in `seq 1 86400`; do | |
sleep 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
trap control_c INT | |
trap control_z TSTP | |
function control_c() { | |
echo "Interrupt detected - CTRL+C" | |
} | |
function control_z() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <unistd.h> | |
#include <stdlib.h> | |
#include <signal.h> | |
int sum; | |
int calculate(int first, int second) { | |
sum = first + second; | |
sleep(3); // represent I/O intensive function call |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <unistd.h> | |
#include <stdlib.h> | |
#include <signal.h> | |
int sum; | |
int calculate(int first, int second) { | |
sum = first + second; | |
sleep(3); // represent I/O intensive function call |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <unistd.h> | |
#include <stdlib.h> | |
#include <signal.h> | |
int calculate(int first, int second) { | |
int sum = first + second; | |
sleep(3); // represent I/O intensive function call | |
return sum; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <unistd.h> | |
#include <stdlib.h> | |
#include <signal.h> | |
int sum; | |
int calculate(int first, int second) { | |
sum = first + second; | |
sleep(3); // represent I/O intensive function call |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <unistd.h> | |
int sum; | |
int calculate(int first, int second) { | |
sum = first + second; | |
sleep(3); // represent I/O intensive function call | |
return sum; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use nix::sys::signal::*; | |
use nix::sys::signal::SigAction; | |
use std::time::Duration; | |
use std::thread; | |
fn calculate(first: i32, second: i32) -> i32 { | |
let sum = first + second; | |
thread::sleep(Duration::from_secs(3)); | |
sum | |
} |
NewerOlder