klay

joined 1 year ago
[–] [email protected] 8 points 1 year ago (1 children)

That doesn't answer the question, they asked if it's open source. I agree, I don't want to replace one sketchy data-harvesting service with another, I'd be a lot more comfortable giving shutup10 control of my system if it was on github or gitlab.

[–] [email protected] 7 points 1 year ago

Won't this delete the two newest files, as opposed to everything except the two newest files?

[–] [email protected] 7 points 1 year ago (3 children)

I just looked up the man page, and actually head -n -2 means "everything up to but not including the last two lines", so this should always leave two files remaining.

[–] [email protected] 5 points 1 year ago* (last edited 1 year ago) (2 children)

Ah! This is a shell pipe! It's composing several smaller commands together, cool stuff.

  • ls -1 is the grep-friendly version of ls, it prints one entry per line, like a shopping list.

  • head takes a set number of entries from the head of a list, in this case ~~2 items.~~ negative two, meaning "all but the last two."

  • xargs takes the incoming pipe and converts it into extra arguments, in this case applying those arguments to rm.

So, combined, this says "list all the .dump files, pick ~~the first two,~~ all but the last two, and delete them." Presumably the first are the oldest ones and the last are the newest, if the .dump files are named chronologically.

 

Updated my self-hosting tutorial based on suggestions from last time. The biggest change is the new chapter on network security. If anyone out there is a security nerd I'd love your feedback! I tried to strike a balance between playing it safe and getting something into production.