From 9b347ba72ce4c78e5a72d2a6cd2cd1868da09097 Mon Sep 17 00:00:00 2001 From: PrincessPi3 Date: Tue, 14 Oct 2025 06:45:57 -0600 Subject: [PATCH] testan a reboold --- installer4.sh | 2 +- reconfig_full.sh | 26 +++++++++++++------------- services.sh | 10 ++++++++-- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/installer4.sh b/installer4.sh index 7abbf10..38ba527 100644 --- a/installer4.sh +++ b/installer4.sh @@ -35,7 +35,7 @@ echo -e "\tEnabling influxdb on boot" sudo systemctl enable influxdb echo -e "\tEnabling telegraf on boot" sudo systemctl enable telegraf -echo -e "\tEnabling chrony on boot" +echo -e "\tEnabling grafana on boot" sudo systemctl enable grafana-server echo -e "\tEnabling syslog-ng on boot" sudo systemctl enable syslog-ng diff --git a/reconfig_full.sh b/reconfig_full.sh index 7b7a124..423a4cb 100644 --- a/reconfig_full.sh +++ b/reconfig_full.sh @@ -46,20 +46,20 @@ bash ./dump_configs.sh # replace dem by truncation echo "Placing the new config files by truncation..." echo -e "\tConfiguring gpsd" -sudo bash -c "cat $gpsd_new > $gpsd" +sudo bash -c $gpsd_new > $gpsd echo -e "\tConfiguring chrony" -sudo bash -c "cat $chrony_new > $chrony" +sudo bash cat $chrony_new > $chrony echo -e "\tConfiguring grafana" -sudo bash -c "cat $grafana_new > $grafana" +sudo bash cat $grafana_new > $grafana echo -e "\tConfiguring influxdb" -sudo bash -c "cat $influxdb_new > $influxdb" +sudo cat $influxdb_new > $influxdb echo -e "\tConfiguring telegraf" -sudo bash -c "cat $telegraf_new > $telegraf" +sudo cat $telegraf_new > $telegraf echo -e "\tConfiguring udev" -sudo bash -c "cat $udev_new > $udev_rule" +sudo cat $udev_new > $udev_rule # setup and install root crontabs -echo -e "\tInstalling crontabs! just save file and exit with no edits" +echo -e "Installing crontabs! just save file and exit with no edits" read -p "Press ENTER to Continue" sudo crontab -e (sudo crontab -l 2>/dev/null && sudo cat $crontab_new) | sudo crontab - @@ -88,17 +88,17 @@ if [ $grepconfig -eq 0 ]; then # if config exists, skip else # APPEND to /boot/firmware/config.txt echo "Appending configs to /boot/firmware/config.txt" - sudo bash -c "cat $bootfirmwareconfig_new >> $bootfirmwareconfig" + sudo cat $bootfirmwareconfig_new >> $bootfirmwareconfig echo $? fi # crontab -echo "Setting up root crontab" -sudo crontab -e -echo "Installing custom root crontab" -sudo crontab $crontab_new +# echo "Setting up root crontab" +# sudo crontab -e +# echo "Installing custom root crontab" +# sudo crontab $crontab_new # start da services bash /home/$username/services.sh start -echo "reconfig_full.sh complete" >> ./status.txt \ No newline at end of file +echo "reconfig_full.sh complete" >> /home/$username/status.txt \ No newline at end of file diff --git a/services.sh b/services.sh index f262643..beabb6e 100644 --- a/services.sh +++ b/services.sh @@ -1,5 +1,11 @@ #!/bin/bash -set -e +# set -e +# get real user +if [ ! -z $SUDO_USER ]; then + username=$SUDO_USER +else + username=$USER +fi if [ -z $1 ]; then echo "Usage: bash services.sh stop|start|restart|status|enable" @@ -8,4 +14,4 @@ fi echo "Running $1 on Services" sudo systemctl $1 gpsd chrony influxdb telegraf grafana-server syslog-ng -echo "services complete" >> ./status.txt +echo "services complete" >> /home/$username/status.txt