I’ve got a simple code, which basically looks like: Which basically outputs the real and effective user id. Now, once build with: go build main.go; I also call sudo chown root:root main && sudo chmod 4755 main to get -rwsr-xr-x permissions on the file. If I understand the concept of the setuid b…
Tag: go
Mount entry in fstab with go
Is there a way to mount a ssh device with Go using an entry in fstab where the mount options are defined. I have been trying syscall.Mount without success. 2018/01/20 11:31:07 operation not permitted exit status 1 A user mount using the fstab entry works fine. sshfs#jeanluc@<remote IP>:/home/jeanluc /ho…
Recursively re-spawn file on fsnotify Remove/Rename (Golang)
The Goal: I am attempting to monitor a file that is subject to being moved or deleted at any time. If and when it is, I’d like to re-generate this file so that an app can continue to write to it. Attempted: I have attempted to do this by implementing two functions, monitorFile() to listen for fsnotify e…
gocql package golang two file version in same install
getting this error when trying to run a go file (which should run) When I look at the documentation of go 1.7 I find that ClusterConfig does have a field ConnectTimeout. (go version = 1.7). If I go to the github.com directory in my go path I find a directory gocql. In this directory I find a file cluster.go w…
Understanding Linux write performance
I’ve been doing some benchmarking to try and understand write performance on Linux, and I don’t understand the results I got (I’m using ext4 on Ubuntu 17.04, though I’m more interested in understanding ext4 if anything, than I am in comparing filesystems). Specifically, I understand th…
How to run multiple Go lang http Servers at the same time and test them using command line?
EDIT: My aim was to run multiple Go HTTP Servers at the same time. I was facing some issues while accessing the Go HTTP server running on multiple ports while using Nginx reverse proxy. Finally, this is the code that I used to run multiple servers. Few newbie mistakes I was making: ping http://localhost:9000 …
Golang Mac OSX build for Docker machine
I need to run Golang application on Docker machine. I’m working on Mac OSX and Docker is working on top of Linux virtual machine, so binaries builded on Mac are not runnable on Docker. I see two ways here: cross-compile binaries on Mac for linux OS copy project sources to docker, run ‘go get’…
How do I run a simple Go server as a daemon in Debian?
I recently wrote a simple server in Go: It works perfectly well if compiled and then executed by ./go_http_server &. The problem is that it doesn’t survive reboots. So after some reading, I attempted to daemonize it by placing a script in /etc/init.d: …then running update-rc.d go_http_server d…
Send signal to other process
since os/signal is only for handling of incoming signals I’m asking if there is a native way to send signals to other processes? Edit: The process I want to mange is nginx. My Go application should listen for some events and then send a SIGHUP to nginx to reload its configuration Answer If you have crea…
Linux display command works in terminal, but not in systemd service
I made a web app to turn off my computer’s screens, there are a few different technologies but it’s fairly simple: I have a html/js frontend that detects a button click (Screens On / Screens Off) which sends the option to the PHP backend via ajax The php then connects over a tcp port, sending the …