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 thisstable
parent
dec121cb2d
commit
36ae1964ad
|
|
@ -69,15 +69,14 @@ func main() {
|
||||||
var daemon bool=false
|
var daemon bool=false
|
||||||
var interval int=1440
|
var interval int=1440
|
||||||
var versionflag bool=false
|
var versionflag bool=false
|
||||||
|
var removetimestamp bool=false
|
||||||
var siteBuff []siteList
|
var siteBuff []siteList
|
||||||
|
|
||||||
// GPL information
|
|
||||||
fmt.Println(GPL)
|
|
||||||
|
|
||||||
// Parsing Flags
|
// Parsing Flags
|
||||||
flag.BoolVar(&daemon, "d", false, "Should this be run in daemon mode")
|
flag.BoolVar(&daemon, "d", false, "Should this be run in daemon mode")
|
||||||
flag.IntVar(&interval, "t", 1440, "Minutes until next run of daemon")
|
flag.IntVar(&interval, "t", 1440, "Minutes until next run of daemon")
|
||||||
flag.BoolVar(&versionflag, "version", false, "show version information")
|
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()
|
flag.Parse()
|
||||||
|
|
||||||
// Display version information
|
// Display version information
|
||||||
|
|
@ -86,6 +85,14 @@ func main() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if timestamp should be removed
|
||||||
|
if removetimestamp {
|
||||||
|
log.SetFlags(0)
|
||||||
|
}else{
|
||||||
|
// GPL information
|
||||||
|
fmt.Println(GPL)
|
||||||
|
}
|
||||||
|
|
||||||
if daemon {
|
if daemon {
|
||||||
log.Print("daemon:" , daemon)
|
log.Print("daemon:" , daemon)
|
||||||
log.Print("interval:",interval)
|
log.Print("interval:",interval)
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=update the hosts file to remove ads
|
Description=rhosts updating the hosts file to remove ads
|
||||||
Wants=network-online.target
|
Wants=network-online.target
|
||||||
After=network.target network-online.target
|
After=network.target network-online.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStart=/usr/local/bin/rhosts
|
ExecStart=/usr/local/bin/rhosts --removetimestamp
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue