Added removetimestamp flag

This is useful for logging programs such as systemd to run the program without
having double timestamps. It also remove the GPL license information

Updated the Systemd service to use this
stable
Justin Reichardt 2022-06-12 21:09:06 -05:00
parent dec121cb2d
commit 36ae1964ad
2 changed files with 12 additions and 5 deletions

View File

@ -69,15 +69,14 @@ func main() {
var daemon bool=false
var interval int=1440
var versionflag bool=false
var removetimestamp bool=false
var siteBuff []siteList
// GPL information
fmt.Println(GPL)
// Parsing Flags
flag.BoolVar(&daemon, "d", false, "Should this be run in daemon mode")
flag.IntVar(&interval, "t", 1440, "Minutes until next run of daemon")
flag.BoolVar(&versionflag, "version", false, "show version information")
flag.BoolVar(&removetimestamp, "removetimestamp", false, "Removes the timestamp, used with logging programs to prevent a double timestamp")
flag.Parse()
// Display version information
@ -86,6 +85,14 @@ func main() {
return
}
// Check if timestamp should be removed
if removetimestamp {
log.SetFlags(0)
}else{
// GPL information
fmt.Println(GPL)
}
if daemon {
log.Print("daemon:" , daemon)
log.Print("interval:",interval)

View File

@ -1,11 +1,11 @@
[Unit]
Description=update the hosts file to remove ads
Description=rhosts updating the hosts file to remove ads
Wants=network-online.target
After=network.target network-online.target
[Service]
Type=oneshot
ExecStart=/usr/local/bin/rhosts
ExecStart=/usr/local/bin/rhosts --removetimestamp
[Install]
WantedBy=multi-user.target