Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Search - "crontab"
-
boss' revenge
So here https://devrant.com/rants/1349878/... posted prank played on boss. For 3days I been freaking out what boss will do as revenge (check env and alias everytime I login). Then yesterday happened his revenge.
Was doing testing on my programs & sometime some programs would run but sometime it get segmentation fault. Seemed random first but then saw a pattern... everytime I get segmentation fault and I run again it would be fine. Checked alias... nothing, /etc/crontab, env, ps -ef... nothing seemed off, cksum of my binary... correct. Fuck! "What my boss did?" asked myself. Finally .5hrs later I saw entry in my id's crontab but then 1min later it's gone from my crontab
From there figured out how boss did it:
1) He replaced ntpd with his C program that runs in background creating an entry in my crontab every few mins
2) The entry in my crontab set to run /foobar/ulittleprick.sh every 2mins
3) ulittleprick.sh picks random binary owned by me, rename binary.name to .binary.name.nitwit and create a script named binary.name
4) Then ulittleprick.sh will remove itself from cron
What the generated binary.name script does? Sleep for 2 secs, echo "Segmentation fault", then rename back .binary.name.nitwit to binary.name. It even exits with status 139! I want to cry! Worst part is comment in 2nd line of ulittleprick.sh... kill me now29 -
Found a coworker's unattended Mac? Let us freak em out (err prank em out).
Open the terminal app and type:
crontab -e
Append:
*/30 * * * * say -v whisper "I am watching you"
Save and close the file. You're welcome. Linux user replace say with espeak command ;). Credit https://twitter.com/JZdziarski/...3 -
I fucking HATE it when devs refer to "cronjob" as some kind of fucking webservice and not the actual crontab.3
-
Ive never really used vim, and therefore not completely understood all the jokes about it..
Yesterday, i somehow ended up editing my crontab with vim.
I have no idea how i managed to quit it, but something worked.
NOTE: No hardware was damaged in the process9 -
The company I work for is currently maintaining some websites under an old (>1.5 years) version of Drupal, which has some well known vulnerabilities.
Yesterday we've found out somebody used them to inject php code into every single .php file on the machine. We've been discussing for hours about how to recover data, upgrade stuff, and maybe switch to something else. I've said jokingly "or we could put a find command in the crontab to sed away the php line they've injected!". Guess what we're doing now on our production servers?7 -
$ crontab -r monthly.irl
The following extra packages will be installed:
pregnancy lib-life lib-fuckyou
Do you wanna continue? [y/n]7 -
Deleted a servers crontab by executing crontab -r instead of crontab -e (typo mistake)
crontab -r deletes the users crontab without any confirmation and, just to top it off, the e key is located right next to r. WTH
At least we have backups.3 -
I was part of a on-call rotation. We had ~800 microsites with decent traffic on this one box, because that's a good idea...
One day the box was experiencing kernel panics and causing core dumps. After exhausting every possiblity I decided it was time to restart the box:
sudo shutdown now
Missed the -r and the box was not accessible remotely. Had to wait for someone at the data center to terminal in.
Downtime was ~2 hours.
This was caused by a crontab that automatically ran apt-get update & apt-get upgrade... Also made by me... None of this should have worked or allowed to be done! -
I think my server got hacked, yesterday I made a new server on scaleway for the sake of testing I made a user called dev, with password dev. Forgot to change password before I went to bed.
Logged in today to find that load is 5x.x and this (image) in my crontab
Note to self: You are a disgrace, who the hell uses 'dev' as password for ssh on port 22 -_-21 -
I really wanna share this with you guys.
We have a couple of physical servers (yeah, I know) provided by a company owned by a friend of my boss. One of them, which I'll refer to as S1, hosted a couple of websites based on Drupal 7... Long story short, every php file got compromised after someone used a vulnerability within D7's core to inject malicious code. Whatver, wasn't a project of mine, and no one bothered to do anything about it... The client was even happy about not doing anything about it. We did stop making backups of such websites however, to avoid spreading the damage (right?). So, no one cared about this for months!
But last monday? The physical server was offline. I powered it on again via its web management interface... Dead after less than an hour. No backups. Oh well, I guess I couls keep powering it on to check what's wrong with it and attempt to fix it...
That's when I've learned how the web management interface works: power on/reboot requests prompted actual workers to reach the physical server and press the power on/reboot buttons.
That took a while to sink in. I mean, ok, theu are physical servers... But aren't they managed anyhow? They are just... Whatever. Rebooting over and over wasn't the solution, so I asked if they could move the HDD to another of our servers... The answer was it required to buy a "server installation" package. In short, we'd have had to buy a new physical server, or renew the subscription of one we already owned for 6 months.
So... I've literally spent the rest of the day bothering their emoloyeea to reboot S1, until I've reached the "daily reboot reauests limit" (which amounts to 3 reauests. seriously), whicj magically opened a support ticket where a random guy advised to stop using VNC as "the server was responsive" and offeres to help me with the command line.
Fiiine, I sort of appreciate it. My next message has been a kernel log which shows how the OS dying out was due to physical components becoming unavailable after a while, and how S1 lacked a VNC server, being accessible only via ssh. So, the daily reboot limit was removes for S1. Yay.
...What to do though? S1 was down, we had no backups, and asking for manual rebooting every time was slow as Hell. ....Then I went insane. I asked for 1 more reboot. su. crontab -e. */15 * * * * /sbin/shutdown -r +5. while true; do; rsync --timeout=20 --append S1:/stuff .; sleep 60; done.
It worked. We have now again access to 4 hacked, shitty Drupal 7 websites. My boss stopped shouting. I can get back to my own projects.
Apparently, those D7 websites got back online too, still with malicious php code within them. Well, not my problem (for now).
Meanwhile, S1 is still rebooting.3 -
This was about 3 years ago. I’m on vacation and just getting off the plane, when my boss calls me on his cellphone. Apparently the crontab on our main file upload server had gotten nuked, and he was asking if there were any backups.
A word about this server. I work with video, so this thing is doing about a few gigabits of traffic incoming at any moment. The cron jobs are necessary to move and organize these massive files into a sane scheme for processing. Hundreds of drop folders receiving thousands of files resulting in terabytes of data every single day. Our storage vendor tells us we have the third largest deployment they know about.
No cron jobs mean all of this content is just sitting around piling up. I tell him sorry, try contacting $otherAdmin since he’s more familiar with that system.
A few days later, after the vacation, I come back in. $boss and $otherAdmin have reconstructed the crontab from scratch after an all nighter.
I ask how it got deleted.
$boss was training some people how to set up new customers on this file server, and he told the trainees to open the crontab in read-only mode. One of them ran:
crontab -r
Yes, we back up our crontabs now.3 -
-Writes a function that I'm going to schedule for django.
-works in development.
-adds it to production cron using django-crontab
-not working.
-spends 3 hours editing code, searching for similar problems and reading documentations but find nothing wrong and it's still not working.
-maybe it's django-crontab so I decide to just write a custom management command and call it through cron.
-still not working.
-calls function using what I'm telling cron to do.
-everything works.
-?????????
-adds logs to cron command (sorry for not making it earlier)
-mfw the code is not working because I imported 'patterns' in urls.py which has been deprecated since django 1.8 -
require "universe"
require "bioDan"
class ProductManager
def initialize(person_type)
@ideas = Universe.import_random_ideas({ mostly_shitty: true, association: person_type })
life_purpose
end
def life_purpose
@ideas.find_each do |idea|
bioDan.interrupt! unless bioDan.bad_mood?
bioDan.queue << idea
end
end
end
ProductManager.create "enthusiastic prick"
%x[crontab -e "0 09 * * * ruby this_script.rb > /dev/null"]
# 😥7 -
Somebody tell me why I shouldn't use systemd timers, as opposed to crontab entries. Because I've been very impressed with them, so far.8
-
Not exactly a data loss, but on server hosting almost all of clients' websites.
$ crontab -e
Except finger slipped and it became -r. *facepalm*1 -
So, I'll explain how my day went with just 2 sentences.
1: Difference between crontab -e and crontab -r.
2: The keys 'E' and 'R' are right next to each other!
If you've understood what just happened, your next question should be "Jason, which environment?"
"PRODUCTION!!!"8 -
So… I prefer nano over other terminal editors (Mainly because I don’t understand how to use others properly) and I wasn’t really aware of the VISUAL and EDITOR environment variables. So on my Arch machine most things would default to vi. Vi to me is like an annoying pop-up that really doesn’t want you to close it (Tho, one thing I did learn eventually was how to close it ). So at some point I quickly wanted to edit crontab as root and I just couldn't manage to get crontab to use nano. So what did I do?
sudo pacman -R vi
ln -s /usr/bin/nano /usr/bin/vi
I symlinked nano to vi and it finally worked. I know that there are probably countless ways this could’ve been done better but in that case I wouldn't have posted it here under wk81 ;)5 -
ZNC shenanigans yesterday...
So, yesterday in the midst a massive heat wave I went ahead, booze in hand, to install myself an IRC bouncer called ZNC. All goes well, it gets its own little container, VPN connection, own user, yada yada yada.. a nice configuration system-wise.
But then comes ZNC. Installed it a few times actually, and failed a fair few times too. Apparently Chrome and Firefox block port 6697 for ZNC's web interface outright. Firefox allows you to override it manually, Chrome flat out refuses to do anything with it. Thank you for this amazing level of protection Google. I didn't notice a thing. Thank you so much for treating me like a goddamn user. You know Google, it felt a lot like those plastic nightmares in electronics, ultrasonic welding, gluing shit in (oh that reminds me of the Nexus 6P, but let's not go there).. Google, you are amazing. Best billion dollar company I've ever seen. Anyway.
So I installed ZNC, moved the client to bouncer connection to port 8080 eventually, and it somewhat worked. Though apparently ZNC in its infinite wisdom does both web interface and IRC itself on the same port. How they do it, no idea. But somehow they do.
And now comes the good part.. configuration of this complete and utter piece of shit, ZNC. So I added my Freenode username, password, yada yada yada.. turns out that ZNC in its infinite wisdom puts the password on the stdout. Reminded me a lot about my ISP sending me my password via postal mail. You know, it's one thing that your application knows the plaintext password, but it's something else entirely to openly share that you do. If anything it tells them that something is seriously wrong but fuck! You don't put passwords on the goddamn stdout!
But it doesn't end there. The default configuration it did for Freenode was a server password. Now, you can usually use 3 ways to authenticate, each with their advantages and disadvantages. These are server password, SASL and NickServ. SASL is widely regarded to be the best option and if it's supported by the IRC server, that's what everyone should use. Server password and NickServ are pretty much fallback.
So, plaintext password, default server password instead of SASL, what else.. oh, yeah. ZNC would be a server, right. Something that runs pretty much forever, 24/7. So you'd probably expect there to be a systemd unit for it... Except, nope, there isn't. The ZNC project recommends that you launch it from the crontab. Let that sink in for a moment.. the fucking crontab. For initializing services. My whole life as a sysadmin was a lie. Cron is now an init system.
Fortunately that's about all I recall to be wrong with this thing. But there's a few things that I really want to tell any greenhorn developers out there... Always look at best practices. Never take shortcuts. The right way is going to be the best way 99% of the time. That way you don't have to go back and fix it. Do your app modularly so that a fix can be done quickly and easily. Store passwords securely and if you can't, let the user know and offer alternatives. Don't put it on the stdout. Always assume that your users will go with default options when in doubt. I love tweaking but defaults should always be sane ones.
One more thing that's mostly a jab. The ZNC software is hosted on a .in domain, which would.. quite honestly.. explain a lot. Is India becoming the next Chinese manufacturers for software? Except that in India the internet access is not restricted despite their civilization perhaps not being fully ready for it yet. India, develop and develop properly. It will take a while but you'll get there. But please don't put atrocities like this into the world. Lastly, I know it's hard and I've been there with my own distribution project too. Accept feedback. It's rough, but it is valuable. Listen to the people that criticize your project.9 -
NOTHING FUCKING WORKS OMG.
I WANT YOU TO RUN EVERY FUCKING 15 MINUTES, IS THAT SO FUCKING HARD? THE ONLY THING THAT'S GOING TO BE HARD AROUND HERE, IS ME!
Geez, all I am trying to do is to run a php script every 15 minutes, and literally every solution I have tried has failed...4 -
Typed crontab - r instead of
crontab - e, gonna be a long weekend to recover crons from log files.3 -
Had a customer today that claimed that crontab did not work as it should, and he has proof of that (in form of some very abstract logs).
Well, I guess noone can rely on one of the most fundamental binary in the unix world. -
Made this one-liner today:
hostname $(curl nsanamegenerator.com | grep body | sed -e 's/<.*;//g' | sed -e 's/<.*>//g')
and added it to my laptop's crontab...4 -
Just a note to everyone. Please make sure to test your script before putting it on crontab and soft-deleting all backups. They are restored now but seriously...4
-
My selenium script cronjob is not running on the VPS.
I am not sure what's wrong with it
Even the crond service status just shows
the session was opened for the user root
shows the command
the session closed for user root
I tried the tons of solution available but nothing worked
I am using Ubuntu 16.04 with LXDE13 -
I want to understand Linux services better. Most of the time if I want to run a process in the background, I just use nohup and &
And put the commands in either init.d or crontab.
But lately I've seen some more complex scripts where it's called like logstash start/stop which does a free things including recording the PID somewhere?
In Linux terms it seems to be called starting a daemon. But what's the difference, benefit to all this complexity?8 -
So I just ran crontab -r while thinking that I should be careful not to run it when trying to run crontab -e FML!4