Another attempt at crash mailing
This commit is contained in:
parent
67ff97b27d
commit
307a122518
|
@ -5,5 +5,5 @@ if [ $SERVICE_RESULT == "success" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
/home/hmn/hmn/adminmailer/adminmailer "[$1] Status changed" <<ERRMAIL
|
/home/hmn/hmn/adminmailer/adminmailer "[$1] Status changed" <<ERRMAIL
|
||||||
$(service "$1" status)
|
$(systemctl status --full "$1")
|
||||||
ERRMAIL
|
ERRMAIL
|
||||||
|
|
|
@ -28,7 +28,7 @@ LimitNPROC=512
|
||||||
PrivateTmp=true
|
PrivateTmp=true
|
||||||
ProtectSystem=full
|
ProtectSystem=full
|
||||||
AmbientCapabilities=CAP_NET_BIND_SERVICE
|
AmbientCapabilities=CAP_NET_BIND_SERVICE
|
||||||
ExecStopPost=status-email@%n.service
|
ExecStopPost=/home/hmn/hmn/server/adminmailer.sh %n
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
|
@ -10,7 +10,7 @@ ExecStart=/home/hmn/hmn/cinera/start.sh
|
||||||
ExecStop=/home/hmn/hmn/cinera/stop.sh
|
ExecStop=/home/hmn/hmn/cinera/stop.sh
|
||||||
PIDFile=/home/hmn/hmn/cinera/data/cinera.pid
|
PIDFile=/home/hmn/hmn/cinera/data/cinera.pid
|
||||||
Restart=always
|
Restart=always
|
||||||
ExecStopPost=status-email@%n.service
|
ExecStopPost=/home/hmn/hmn/server/adminmailer.sh %n
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
|
@ -8,7 +8,7 @@ Group=hmn
|
||||||
ExecStart=/home/hmn/bin/hmn
|
ExecStart=/home/hmn/bin/hmn
|
||||||
Restart=always
|
Restart=always
|
||||||
TimeoutStopSec=15
|
TimeoutStopSec=15
|
||||||
ExecStopPost=status-email@%n.service
|
ExecStopPost=/home/hmn/hmn/server/adminmailer.sh %n
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
|
@ -199,11 +199,9 @@ if [ $checkpoint -lt 100 ]; then
|
||||||
cp /home/hmn/hmn/server/caddy.service /etc/systemd/system/caddy.service
|
cp /home/hmn/hmn/server/caddy.service /etc/systemd/system/caddy.service
|
||||||
cp /home/hmn/hmn/server/hmn.service /etc/systemd/system/hmn.service
|
cp /home/hmn/hmn/server/hmn.service /etc/systemd/system/hmn.service
|
||||||
cp /home/hmn/hmn/server/cinera.service /etc/systemd/system/cinera.service
|
cp /home/hmn/hmn/server/cinera.service /etc/systemd/system/cinera.service
|
||||||
cp /home/hmn/hmn/server/status-email@.service /etc/systemd/system/status-email@.service
|
|
||||||
chmod 644 /etc/systemd/system/caddy.service
|
chmod 644 /etc/systemd/system/caddy.service
|
||||||
chmod 644 /etc/systemd/system/hmn.service
|
chmod 644 /etc/systemd/system/hmn.service
|
||||||
chmod 644 /etc/systemd/system/cinera.service
|
chmod 644 /etc/systemd/system/cinera.service
|
||||||
chmod 644 /etc/systemd/system/status-email@.service
|
|
||||||
|
|
||||||
cp /home/hmn/hmn/server/logrotate /etc/logrotate.d/hmn
|
cp /home/hmn/hmn/server/logrotate /etc/logrotate.d/hmn
|
||||||
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=Status email for %i
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
ExecStart=/home/hmn/hmn/server/adminmailer.sh %i
|
|
||||||
User=root
|
|
||||||
Group=systemd-journal
|
|
|
@ -365,7 +365,8 @@ func SeedFromFile(seedFile string, afterMigration types.MigrationVersion) {
|
||||||
seedFile,
|
seedFile,
|
||||||
)
|
)
|
||||||
fmt.Println("Running command:", cmd)
|
fmt.Println("Running command:", cmd)
|
||||||
if err = cmd.Run(); err != nil {
|
if output, err := cmd.CombinedOutput(); err != nil {
|
||||||
|
fmt.Print(string(output))
|
||||||
exitError, isExit := err.(*exec.ExitError)
|
exitError, isExit := err.(*exec.ExitError)
|
||||||
if isExit {
|
if isExit {
|
||||||
panic(fmt.Errorf("failed to execute seed: %w\n%s", err, string(exitError.Stderr)))
|
panic(fmt.Errorf("failed to execute seed: %w\n%s", err, string(exitError.Stderr)))
|
||||||
|
|
Loading…
Reference in New Issue