EKHO-13 | justfile
created justfile, added service file
This commit is contained in:
@@ -0,0 +1,14 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Ekho MOTD Server
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
Restart=always
|
||||||
|
RestartSec=5
|
||||||
|
User=
|
||||||
|
ExecStart=/usr/local/bin/server
|
||||||
|
WorkingDirectory=/home/
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
# delete server bin
|
||||||
|
[private]
|
||||||
|
server_clean:
|
||||||
|
rm server
|
||||||
|
|
||||||
|
# delete client bin
|
||||||
|
[private]
|
||||||
|
client_clean:
|
||||||
|
rm client
|
||||||
|
|
||||||
|
# delete binaries
|
||||||
|
clean: server_clean client_clean
|
||||||
|
|
||||||
|
# build server bin
|
||||||
|
server:
|
||||||
|
go build server.go
|
||||||
|
|
||||||
|
# build client bin
|
||||||
|
client:
|
||||||
|
go build client.go
|
||||||
|
|
||||||
|
# build both bins
|
||||||
|
build: client server
|
||||||
|
|
||||||
|
# delete binaries and make them again
|
||||||
|
rebuild: clean build
|
||||||
|
|
||||||
|
# install server
|
||||||
|
ins_server:
|
||||||
|
#!/usr/bin/bash
|
||||||
|
echo "enter port of server or leave blank to use default (1300)"
|
||||||
|
read PORT
|
||||||
|
if [[ $PORT -ne "" ]]; then
|
||||||
|
sed -i -e "s/1300/$PORT/" server.go
|
||||||
|
fi
|
||||||
|
echo "go build server.go"
|
||||||
|
go build server.go
|
||||||
|
USER=($(users))
|
||||||
|
sed -i -e "s/^User=/User=${USER[0]}/" ekho.service
|
||||||
|
sed -i -e "s/^WorkingDirectory=.*/WorkingDirectory=\/home\/${USER[0]}\//" ekho.service
|
||||||
|
echo "sudo mv server /usr/local/bin/server"
|
||||||
|
sudo mv server /usr/local/bin/server
|
||||||
|
echo "sudo mv ekho.service /etc/systemd/system/"
|
||||||
|
sudo mv ekho.service /etc/systemd/system/
|
||||||
|
|
||||||
|
# install client
|
||||||
|
ins_client:
|
||||||
|
#!/usr/bin/bash
|
||||||
|
echo "enter ip and port of server, 'aaa.bbb.ccc.ddd:port"
|
||||||
|
read IP_PORT
|
||||||
|
sed -i -e "s/:1300/$IP_PORT/" client.go
|
||||||
|
echo "go build -o ekho client.go"
|
||||||
|
go build -o ekho client.go
|
||||||
|
sed -i -e "s/$IP_PORT/:1300/" client.go
|
||||||
|
echo "sudo mv ekho /usr/local/bin/"
|
||||||
|
sudo mv ekho /usr/local/bin/
|
||||||
|
echo "add 'ekho' to shell config (config.fish, .bashrc, etc)"
|
||||||
|
|
||||||
@@ -395,7 +395,7 @@ func main() {
|
|||||||
|
|
||||||
if vv { // display info and exit
|
if vv { // display info and exit
|
||||||
fmt.Println( "ekho server v" + VERS )
|
fmt.Println( "ekho server v" + VERS )
|
||||||
fmt.Println( "ekho is named after the Echo the Oread" )
|
fmt.Println( "ekho is named after Echo the Oread" )
|
||||||
fmt.Println( "in Greek mythology, Echo was cursed by Hera to only be able to say the last words spoken to her" )
|
fmt.Println( "in Greek mythology, Echo was cursed by Hera to only be able to say the last words spoken to her" )
|
||||||
fmt.Println( "i found this to be quite fitting for a MOTD server" )
|
fmt.Println( "i found this to be quite fitting for a MOTD server" )
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user