0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Linux cronでOS再起動を行う

0
Posted at

"shutdown -r now"ではなく、"/usr/sbin/shutdown -r now"とするのがポイント

再起動コマンドをシェルファイルに記載し、cronからシェルファイルを実行する場合。
パスの関係でshutdown -r nowと記述しても再起動されないので注意が必要
以下のように、/usr/sbin/shutdown -r nowと記述する必要がある

rebootDate=`date "+%d"`

if [ ${rebootDate} -eq "15" ]; then
  /usr/sbin/shutdown -r now
fi
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?