Monorepo for Aesthetic.Computer aesthetic.computer
at main 51 lines 1.5 kB view raw
1#!/usr/bin/env fish 2 3# Get the current user's username 4set username (whoami) 5 6# Ensure the required directories exist 7mkdir -p ~/.config/systemd/user 8 9# Create the service file 10echo "[Unit] 11Description=Aesthetic Daemon Service 12 13[Service] 14ExecStart=/usr/bin/node /home/$username/aesthetic-computer/daemon/daemon.js 15Restart=always 16Environment=NODE_ENV=production 17Environment=PATH=/home/linuxbrew/.linuxbrew/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 18WorkingDirectory=/home/$username/aesthetic-computer/daemon/ 19ExecReload=/bin/kill -HUP \$MAINPID 20 21[Install] 22WantedBy=default.target" > ~/.config/systemd/user/aesthetic-daemon.service 23 24# Create the path unit file 25echo "[Unit] 26Description=Watch aesthetic daemon.js for changes 27 28[Path] 29PathChanged=/home/$username/aesthetic-computer/daemon/daemon.js 30 31[Install] 32WantedBy=default.target" > ~/.config/systemd/user/aesthetic-daemon.path 33 34# Reload the systemd manager configuration 35systemctl --user daemon-reload 36 37# Ensure the script has execute permissions 38chmod +x /home/$username/aesthetic-computer/ssl-dev/ssl-install.fish 39 40# Enable the service and the path unit 41systemctl --user enable aesthetic-daemon.service 42systemctl --user enable aesthetic-daemon.path 43 44# Start the service and the path unit 45systemctl --user start aesthetic-daemon.service 46systemctl --user start aesthetic-daemon.path 47 48# Restart the service if it is already running 49systemctl --user restart aesthetic-daemon.service 50 51echo "😈 Aesthetic Daemon systemd service installed and started successfully!"