简体   繁体   中英

Linux bash script stuck in sleep state

I use the SpiderOak client to backup my NAS server data to the cloud. For months this has been working well. However, today, after running for a while, the cronjob process got stuck in a sleep state. I need help figuring out why and how to fix

I recently lost the cronjob script that had been working well, so I had to write up a new bash script. Maybe I made a mistake. Here it is:

#!/bin/sh
WORKING_FILE=/volume1/Volume_1/spideroak.lock
RESULT_FILE=/volume1/Volume_1/spideroak.log

# Cancel if there is an ongoing backup
if [ -f "$WORKING_FILE" ]
  then
    echo "Error: $WORKING_FILE already exists; backup is already running."
   exit 1;
  fi

# Run backup and save results to file with the name that gets checked above
/opt/SpiderOakONE/usr/bin/SpiderOakONE --batchmode --verbose --redirect="$WORKING_FILE"

# Rename log once backup is complete
mv "$WORKING_FILE" "$RESULT_FILE"

# Set log file permissions and exit
chmod 644 "$RESULT_FILE"
echo "Backup complete. Result saved to $RESULT_FILE"

I also recently updated the firmware of the NAS but don't know whether that could play a role by putting long-lasting processes to sleep. If I replace the backup command with something that only takes a few seconds to complete, everything works. eg: if I replace --batchmode --verbose with --selection and leave everything else as is.

The NAS is a Synology DS-216+ running DSM 6.0.2-8451 Update 4 firmware

不一定是答案(尽管极有可能是答案),我建议您将“ WORKING_FILE”的位置更改为/ tmp -每次启动时都会清除此文件夹(请检查Linux发行版确保这是您的默认设置),即使您的脚本因某种原因无法执行此操作,它也会删除控制文件。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM