diff --git a/bench/utils.py b/bench/utils.py index f73eb2e0..fd3db388 100755 --- a/bench/utils.py +++ b/bench/utils.py @@ -407,8 +407,6 @@ def restart_supervisor_processes(bench_path='.', web_workers=False): else: group = 'frappe:' - if find_executable('systemctl'): - exec_cmd('sudo systemctl restart supervisor.service && sleep 1') exec_cmd('sudo supervisorctl restart {group}'.format(group=group), cwd=bench_path) def set_default_site(site, bench_path='.'): diff --git a/vm/scripts/restart_supervisor.sh b/vm/scripts/restart_supervisor.sh new file mode 100644 index 00000000..0afad870 --- /dev/null +++ b/vm/scripts/restart_supervisor.sh @@ -0,0 +1,14 @@ +#! /bin/bash + + +# Write out current crontab +crontab -l > current_cron + +# Echo new cron into cron file +echo "@reboot sleep 20 && systemctl restart supervisor" >> current_cron + +# Install new cron file +crontab current_cron + +# Delete the temporary cron file +rm current_cron \ No newline at end of file diff --git a/vm/vm-develop.json b/vm/vm-develop.json index 8d92fd9c..c131e669 100644 --- a/vm/vm-develop.json +++ b/vm/vm-develop.json @@ -80,6 +80,10 @@ }, { "type": "shell", "script": "scripts/set_message.sh" + }, { + "type": "shell", + "execute_command": "echo 'frappe' | {{.Vars}} sudo -S -E bash '{{.Path}}'", + "script": "scripts/restart_supervisor.sh" }], "post-processors": [{ "type": "checksum", diff --git a/vm/vm-production.json b/vm/vm-production.json index ce478fa9..b43828b2 100644 --- a/vm/vm-production.json +++ b/vm/vm-production.json @@ -80,6 +80,10 @@ }, { "type": "shell", "script": "scripts/set_message.sh" + }, { + "type": "shell", + "execute_command": "echo 'frappe' | {{.Vars}} sudo -S -E bash '{{.Path}}'", + "script": "scripts/restart_supervisor.sh" }], "post-processors": [{ "type": "checksum",