0

Once upon a time I created a script that cleans my "Downloads" directory. By the way, all it does is to move files from ~/Downloads to ~/Downloads/Trash. I store my shell script in ~/shell_scripts.

I want to update the script, but sadly i realised I don't remember how I managed to execute it automatically :-( I started to search through Google on places to put execution of custom script, but in neither I found mentions of my script.

What I did so far was:

  1. Checked .bashrc for both script name clean_downloads.sh and directory shell_scripts
  2. Checked .bash_logout
  3. .bash_login and .bash_profile files doesn't exist in my home directory
  4. Checked /etc/profile for mentions and /etc/profile.d for copies of the script
  5. Checked /etc/init.d

I haven't found copies of the script in any places except mentioned !/shell_scripts directory. I suspect somehow I added an execution line to a system file, because I'm almost sure I did some kind of verification if I typed everything correctly.

Do you know any ways to find I kind of system logs if a particular script was executed and why (from which file)?

1
  • Have you checked the cron table (maybe also as root)? /etc/rc.local? Inside /etc/init.d/ as a systemV init script? Is it maybe a systemd service?
    – marc
    Commented May 30, 2020 at 21:00

1 Answer 1

1

I'm suspecting cron is executing your script periodically. In that case the following commands might help you find the corresponding entry in cron's configuration:

crontab -e
cat /etc/crontab
ls /etc/cron*
1
  • Wow, you were right! Thank you, there it is: @reboot /home/asmox/shell_scripts/clean_downloads.sh
    – Asmoox
    Commented May 30, 2020 at 21:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .