Jump to content
marketdrayton

Continuous terminal commands (TFTP)

Recommended Posts

Hello,
 
I am attempting to create a workflow that allows me to turn on the built in TFTP server in Mac OS, followed (or before) opening a particular finder window and the creating of a file.
 
The commands need to be;
 
To launch the daemon run the following commands:
sudo launchctl load -F /System/Library/LaunchDaemons/tftp.plist
sudo launchctl start com.apple.tftpd

Be sure Read/Write/eXecute permissions are set on the tftpboot folder and any files you wish to transfer:
sudo chmod 777 /private/tftpboot
sudo chmod 777 /private/tftpboot/*

If you’ll be transferring a file TO your TFTP server, the file will technically need to exist on the server beforehand so create it with touch. For example:
sudo touch /private/tftpboot/running-config
sudo chmod 777 /private/tftpboot/running-config

 
I have created (along with the help of a friend) the following workflow. What I would like to do;
1. Is create it so it opens up the finder location first (I can then visibly see the file being created because atm I pre-open the finder window manually). I cannot get this piece to work.
2. Include all of the terminal commands into just on window, with a "sleep x" in between the command lines, and then it auto close that window (I found this, its a preference in terminal rather than a cmd).
3. Close terminal totally. i.e. The entire program.
 
I can share the created workflow, but you will need to replace the "1" in the commands with your Mac PW. Just trying to workout how to do the upload of a workflow....
 
Many, many thanks for any help or advice you can offer.
 

Share this post


Link to post

* I also have another request -when typing the kb shortcut, if I add an argument (i.e. tftp run) it creates the file name run....much more complicated as it will need to edit the terminal commands that are pre-defined.

Share this post


Link to post

For (1), run the command open /private first (that opens /private in Finder).

 

For (2), you can only (easily) send a single command to Terminal. What you need to do is join your commands with && or ;:

 

sudo launchctl load -F /System/Library/LaunchDaemons/tftp.plist && sudo launchctl start com.apple.tftpd ...

 

To close the terminal afterwards, add ; exit to the end of the command, or to close the entire application, run osascript -e 'tell application "Terminal" to quit')

 

You shouldn't put your Mac password in workflows. Instead, edit sudoers to allow your user to run those commands without a password (you still need sudo, though).

Edited by deanishe
Typo

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...