I have a bash script that backs up some files to a remote server using rclone. I want to run this script once every week.

The script asks me two questions: it confirms if I want to run it at that point in time and then it asks for the password for the remote server.

Its easy enough to run a scheduled bash script using cron or launchd. However, the bash script requires user input. AFAIK both launchd and cron run daemons in the background. Ideally, it would launch an instance of the Terminal window and run the script in there.

What's the best way to go about this?

Thank you for the help!

  • rclone seems to have configuration options to not ask for a password which you might investigate further. The alternative is to use an expect script to interact with the program. It is pointless having a password in such a script if an alternative exists to have it the rclone configuration files.
    – meuh
    Nov 3 '17 at 15:41
  • @meuh I want it to ask for a password so that in case the client machine is compromised the attacker will not be able to delete my backups. Nov 3 '17 at 16:04

I think I found the answer here for those wondering:

Needing to open OS X bash script as via launchd IN a terminal window

Not the most robust solution but works. If anyone's got a better idea let us know.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.