Add: stop-schedule.sh
This commit is contained in:
parent
8f5bbe1d6f
commit
8ee8a46082
1 changed files with 12 additions and 0 deletions
12
stop-schedule.sh
Normal file
12
stop-schedule.sh
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 사용자에게 스크립트를 실행할 대기 시간을 입력받습니다.
|
||||
echo "Enter the delay before the script execution (e.g., 5s, 5m, 5h for 5 seconds, 5 minutes, 5 hours respectively):"
|
||||
read delay
|
||||
|
||||
# nohup과 함께 대상 스크립트를 실행하고, 백그라운드에서 sleep 후 실행하도록 합니다.
|
||||
# 그리고 그 PID를 sleep.pid 파일에 저장합니다.
|
||||
nohup bash -c "sleep $delay && ./stop.sh" > nohup.out 2>&1 & echo $! > sleep.pid
|
||||
|
||||
echo "The script will be executed after the delay: $delay. The PID of the sleep process is saved in the file: sleep.pid"
|
||||
# kill $(cat sleep.pid)
|
||||
Loading…
Add table
Add a link
Reference in a new issue