aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2016-01-20 22:31:15 +0100
committerJakob Unterwurzacher2016-01-20 22:31:15 +0100
commit9bab220a1b5a10c00c314b15f4c9f879f1473707 (patch)
tree14ca1e3ed4bfd33d3721db79065d64f418219aa3 /main.go
parent17f0eb13396ad31083e786ed64aef368646c2aa6 (diff)
Switch to syslog when running in the background
Diffstat (limited to 'main.go')
-rw-r--r--main.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/main.go b/main.go
index 8fca701..0e66b1c 100644
--- a/main.go
+++ b/main.go
@@ -5,6 +5,7 @@ import (
"flag"
"fmt"
"io/ioutil"
+ "log/syslog"
"os"
"os/exec"
"os/signal"
@@ -276,9 +277,17 @@ func main() {
cryptfs.Debug.Printf("cli args: %v", args)
srv := pathfsFrontend(masterkey, args, confFile)
cryptfs.Info.Println(colorGreen + "Filesystem mounted and ready." + colorReset)
- // We are ready - send USR1 signal to our parent
+ // We are ready - send USR1 signal to our parent and switch to syslog
if args.notifypid > 0 {
sendUsr1(args.notifypid)
+
+ if !args.quiet {
+ switchToSyslog(cryptfs.Info, syslog.LOG_USER|syslog.LOG_INFO)
+ }
+ if args.debug {
+ switchToSyslog(cryptfs.Debug, syslog.LOG_USER|syslog.LOG_DEBUG)
+ }
+ switchToSyslog(cryptfs.Warn, syslog.LOG_USER|syslog.LOG_WARNING)
}
// Wait for SIGINT in the background and unmount ourselves if we get it.
// This prevents a dangling "Transport endpoint is not connected" mountpoint.