Yihan Hu
Yihan Hu

Reputation: 113

Where is the file saved if path is not fully specified?

I have this script that I run at boot using cronjob

#! /bin/bash
IP=$(hostname -I)
time=$(date)
echo "$time: $IP" >> IP0.log
rclone copy /home/pi/odas/IP0.log RaspberryPi:/ODAS

So file grabs the IP address and pipe it into IP0.log. My question is, without specifying the full path, where is this file saved to by default? I have googled around but I don't seem to be using the right keywords. Any help is appreciated

Upvotes: 1

Views: 41

Answers (1)

elliptic_hyperboloid
elliptic_hyperboloid

Reputation: 302

For a user cronjob it should execute in your home directory, but I was unable to find specifics for root cronjobs. You can quickly check by writing the output of pwd into a file to see what the working directory is. pwd >> pwdOutput.txt.

Edit: Root crontab runs in /root.

Upvotes: 1

Related Questions