#!/bin/bash if [ "$EUID" -ne 0 ]; then echo "Please run as root" exit fi echo "Please enter the desired name for the service (e.g., backup). Can only contain [a-z, A-Z, 0-9]: " read SERVICE_NAME echo "Please enter the path to your backup script (e.g., /home/user/service/backup.sh): " read BACKUP_SCRIPT_PATH echo "Please enter the path to the log file for the script (e.g., /home/sem/service/backup.log): " read LOG_FILE_PATH echo "Please enter the working directory for the backup service (e.g., /home/user/service): " read WORKING_DIRECTORY echo "Please enter the desired OnCalendar time for the timer (e.g.'Mon *-*-* 02:00:00'): " read ONCALENDAR_TIME echo "Please enter a description for the interval of the timer (e.g., 'Monday at 02:00'): " read TIMER_DESCRIPTION SERVICE_FILE="/etc/systemd/system/backup-${SERVICE_NAME}.service" TIMER_FILE="/etc/systemd/system/backup-${SERVICE_NAME}.timer" cat > $SERVICE_FILE < $LOG_FILE_PATH User=sem WorkingDirectory=$WORKING_DIRECTORY EOL echo "Created service file at $SERVICE_FILE" cat > $TIMER_FILE <