files, logs, install script update
This commit is contained in:
parent
c0230ce765
commit
57b05d47a9
2 changed files with 19 additions and 7 deletions
|
@ -9,9 +9,9 @@ import (
|
|||
|
||||
func main() {
|
||||
cntxt := &daemon.Context{
|
||||
PidFileName: "/run/godaemon1.pid",
|
||||
PidFileName: "/etc/godaemon/godaemon1.pid",
|
||||
PidFilePerm: 0644,
|
||||
LogFileName: "/var/log/godaemon1.log",
|
||||
LogFileName: "/etc/godaemon/godaemon1.log",
|
||||
LogFilePerm: 0640,
|
||||
WorkDir: "./",
|
||||
Umask: 027,
|
||||
|
|
|
@ -7,18 +7,30 @@ sudo killall godaemon1
|
|||
sudo systemctl disable godaemon1
|
||||
sudo systemctl stop godaemon1
|
||||
sudo systemctl daemon-reload
|
||||
sudo rm -rf /etc/godaemon1/
|
||||
|
||||
# Building
|
||||
temp_dir="$(mktemp -d)"
|
||||
cd $temp_dir
|
||||
echo $temp_dir
|
||||
cd "$temp_dir" || exit
|
||||
echo "$temp_dir"
|
||||
git clone https://git.aliberksandikci.com.tr/liderahenk/go-daemon
|
||||
cd go-daemon/go-daemon/
|
||||
cd go-daemon/go-daemon/ || exit
|
||||
go build -o ./bin/
|
||||
|
||||
# Configurations
|
||||
sudo mkdir -p /etc/godaemon1/
|
||||
sudo touch /etc/godaemon1/userdata.conf
|
||||
sudo cat << EOF | sudo tee -a /etc/godaemon1/userdata.conf > /dev/null
|
||||
The current working directory is: $PWD
|
||||
You are logged in as $(whoami)
|
||||
$HOME | $USER | $SUDO_USER
|
||||
EOF
|
||||
sudo chown root:root /etc/godaemon1/userdata.conf
|
||||
sudo chmod 640 /etc/godaemon1/userdata.conf
|
||||
|
||||
# Installing
|
||||
sudo mv ./bin/godaemon1 /usr/bin/godaemon1
|
||||
if [[ $(ps -jp 1 | awk 'FNR == 2 {print $6}') == "systemd" ]]
|
||||
if [[ $(ps -jp 1 | awk 'FNR == 2 {print $6} ') == "systemd" ]]
|
||||
then
|
||||
sudo mv ./godaemon1.service /etc/systemd/system/
|
||||
fi
|
||||
|
@ -27,4 +39,4 @@ sudo systemctl enable godaemon1
|
|||
sudo systemctl start godaemon1
|
||||
|
||||
# Post-Cleaning
|
||||
sudo rm -rf $temp_dir
|
||||
sudo rm -rf "$temp_dir"
|
Loading…
Reference in a new issue