Saturday, October 26, 2024
Bash Script

Membuat script running background per detik

buat script nya nano /home/kill.sh

#!/bin/bash
for i in `ps -ef |grep danielha|awk ‘{print $2}’`;do kill -9 $i;done

bikin script per detik nya :

nano perdetik.sh

#!/bin/bash
while true
do
/home/kill.sh
sleep 1
done

Running background :

/bin/sh perdetik.sh > /dev/null 2>&1 &

kemudian taro di rc.local supaya kalo di reboot aktif lagi script nya

nano /etc/rc.local

/home/kill1.sh > /dev/null 2>&1 &

cara stop :

ps -ax |grep -i perdetik

kill -9 PID

(Visited 43 times, 1 visits today)
Baca Juga :  Script to alert Memory (RAM)

Similar Posts


Warning: Trying to access array offset on value of type bool in /home/des1gn/hendro-wibiksono.web.id/wp-content/plugins/floating-related-posts/floating-related-posts-pro.php on line 270

Warning: Trying to access array offset on value of type bool in /home/des1gn/hendro-wibiksono.web.id/wp-content/plugins/floating-related-posts/floating-related-posts-pro.php on line 270

Warning: Trying to access array offset on value of type bool in /home/des1gn/hendro-wibiksono.web.id/wp-content/plugins/floating-related-posts/floating-related-posts-pro.php on line 270

Warning: Trying to access array offset on value of type bool in /home/des1gn/hendro-wibiksono.web.id/wp-content/plugins/floating-related-posts/floating-related-posts-pro.php on line 270

Warning: Trying to access array offset on value of type bool in /home/des1gn/hendro-wibiksono.web.id/wp-content/plugins/floating-related-posts/floating-related-posts-pro.php on line 270

Warning: Trying to access array offset on value of type bool in /home/des1gn/hendro-wibiksono.web.id/wp-content/plugins/floating-related-posts/floating-related-posts-pro.php on line 270

Warning: Trying to access array offset on value of type bool in /home/des1gn/hendro-wibiksono.web.id/wp-content/plugins/floating-related-posts/floating-related-posts-pro.php on line 270

Warning: Trying to access array offset on value of type bool in /home/des1gn/hendro-wibiksono.web.id/wp-content/plugins/floating-related-posts/floating-related-posts-pro.php on line 270