files, logs, install script update

This commit is contained in:
Aliberk Sandıkçı 2023-07-30 13:35:15 +03:00
parent c0230ce765
commit 57b05d47a9
Signed by: asandikci
GPG key ID: 25C67A03B5666BC1
2 changed files with 19 additions and 7 deletions

View file

@ -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,

View file

@ -7,15 +7,27 @@ 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" ]]
@ -27,4 +39,4 @@ sudo systemctl enable godaemon1
sudo systemctl start godaemon1
# Post-Cleaning
sudo rm -rf $temp_dir
sudo rm -rf "$temp_dir"