Open vsile opened 6 years ago
I use next service file;
[Unit] Description=Goserver
[Service] Type=simple Restart=always RestartSec=3
Environment=GOPATH=/home/user/goserver/ Environment=BROWSER=gvfs-open WorkingDirectory=/home/user ExecStart=/usr/bin/go run /home/user/goserver/totalmanager.go
[Install] WantedBy=multi-user.target
The script with open-golang is inside totalmanager.go
If I run my script "go run goserver/totalmanager.go" it works!
But if I use "sudo systemctl start totalmanager.service" it doesn't work! May be something wrong with Environment?
I have not tried this myself, but try:
[Service] User=user
to start the service as your user, so it knows who to open the link for.
I use next service file;
[Unit] Description=Goserver
[Service] Type=simple Restart=always RestartSec=3
Environment=GOPATH=/home/user/goserver/ Environment=BROWSER=gvfs-open WorkingDirectory=/home/user ExecStart=/usr/bin/go run /home/user/goserver/totalmanager.go
[Install] WantedBy=multi-user.target
The script with open-golang is inside totalmanager.go
If I run my script "go run goserver/totalmanager.go" it works!
But if I use "sudo systemctl start totalmanager.service" it doesn't work! May be something wrong with Environment?