-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add sudo, supervisorctl to sudoers, create script for regular user to…
… restart odoo
- Loading branch information
1 parent
1b8741b
commit 390950d
Showing
3 changed files
with
39 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
# Allow odoo to run supervisorctl | ||
odoo ALL=(ALL:ALL) NOPASSWD: /usr/bin/supervisorctl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
# Show usage information | ||
usage() { | ||
echo "Usage: odooctl {start|stop|restart}" | ||
exit 1 | ||
} | ||
|
||
# Check if the script was called with an argument | ||
if [ $# -eq 0 ]; then | ||
usage | ||
fi | ||
|
||
# Check the argument and perform the corresponding action | ||
case "$1" in | ||
"start") | ||
sudo supervisorctl start odoo | ||
;; | ||
"stop") | ||
sudo supervisorctl stop odoo | ||
;; | ||
"restart") | ||
sudo supervisorctl restart odoo | ||
;; | ||
*) | ||
usage | ||
;; | ||
esac | ||
|
||
exit 0 |