Skip to content

Instantly share code, notes, and snippets.

@malagebidi
Last active October 23, 2021 05:29
Show Gist options
  • Save malagebidi/89d9bb279767a6172467a2205b1d92ac to your computer and use it in GitHub Desktop.
Save malagebidi/89d9bb279767a6172467a2205b1d92ac to your computer and use it in GitHub Desktop.
#!/bin/sh
#获取当前时间
timestamp() {
date +"%s"
}
t=$(timestamp)
#获取huginn shell command agent每分钟写入的时间
modt=$(cat /tmp/huginn_unix.txt)
#两者比对,如果时间差超过30分钟,预计huginn已经卡住并进行强制重启
diff=$(($(timestamp) - $modt))
if [ $diff -gt 1800 ]; then
cd /home/huginn/huginn && sudo bundle exec rake production:force_stop && sudo bundle exec rake production:export
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment