Handle cases when the procs file does not exist
@@ -42,7 +42,14 @@ module TerminateHelper
`rm -f /etc/monit/conf.d/controller-17443.cfg`
# Stop datastore servers.
- `cat /sys/fs/cgroup/memory/appscale-datastore/cgroup.procs | xargs kill`
+ datastore_cgroup = '/sys/fs/cgroup/memory/appscale-datastore/cgroup.procs'
+ begin
+ File.readlines(datastore_cgroup).each do |pid|
+ `kill #{pid}`
+ end
+ rescue Errno::ENOENT
+ # If there are no processes running, there is no need to stop them.
+ end
`rm -f /etc/logrotate.d/appscale-*`
