hosts icon indicating copy to clipboard operation
hosts copied to clipboard

[Feature request] Temporary entries with auto-deletion using crontabs

Open scratchmex opened this issue 5 years ago • 2 comments

Sometimes you are testing or waiting for some domain to update its DNS and you add your domain to your hosts but often you forgot to delete that entry. I suggest some syntax as parameters to the add command like this:

hosts add --autoremove --time=30m 10.12.13.14 example.com

This command should schedule a crontab job in 30m to run hosts remove example.com

scratchmex avatar Jan 01 '21 21:01 scratchmex

@scratchmex Interesting idea! I'll look into it. Another option for implementation could be the at utility:

  • https://pubs.opengroup.org/onlinepubs/9699919799/utilities/at.html
  • https://stackoverflow.com/a/30378554

xwmx avatar Jan 02 '21 18:01 xwmx

Actually that utility does what I was referring to not crontab. Awesome!

scratchmex avatar Jan 02 '21 19:01 scratchmex