![]() ![]() sh file, but those commands require inputs which would need to be automated in order for me to use for my specific case.Įdit 3: I'm commenting a lot because I don't have enough rep to chat directly with the people trying to help me, new to this site still. The application I'm trying to use this for requires that this be automated completely which is why this is a problem.Įdit 2.5: Once I run the keygen and ssh-copy-id, it no longer prompts for a password at rsync, but this is going to be implemented across many machines, and for this project, I don't mind putting those in some kind of setup. ![]() It allows you to perform a series of actions, such as navigating to a specific directory, creating a folder, and launching a process using the command line. sh file and run itself without user input, this is for a very specific task, sorry.Įdit 2: Doing this as per request of someone helping me, so, I can't provide screenshots unfortunately, but it asks for a password for a user on the 10.3.10.110 whenever I run the rsync command I listed, and whenever I run the ssh-keygen on a new client trying to generate a key for that user at that machine. A bash script is a file containing a sequence of commands that are executed by the bash program line by line. I'm running Ubuntu Server 16.04 LTS on both machines if that helps.Įdit: Not to be super tricky, but whatever the solution is also has to be able to be put into a. If you create a bin directory in your home ( mkdir /bin ) the next. Note that it is a good idea to put your scripts in one place, so you can run them without requiring a path. sudo chmod +x sudo chmod 755 .And after saving you must make it executeable. What my question is that will that -y have it automatically agree to store an ssh key like I'm trying to have it do? Also, how do I have it automatically input a password through the command I'm trying to execute in the ssh when it tries to login as that user to rsync the files? I thought there was something like - that could do that. First line must be this (no spaces before it and first line): /bin/bash. (I just called the users user for reasons, ignore that) I have it set to create a subdirectory based off of the hostname of the machine (please tell me if that looks good too, I'm basing that off code used for a slightly different purpose) which that user does have access to. That is one command, had to cut it in half because it was too long for one line. atrm: Used to remove the specified job from job queue. bashrc Once you have the file open, navigate to the end of the file and add the following line: /path/to/your/script.sh Make sure to replace '/path/to/your/script. bashrc file in a text editor using the following command: nano. Other Similar Commands: atq: Used to display the queue of pending jobs (this is because at and batch both uses the same job queue). To add your script to /.bashrc, Open a terminal and navigate to your home directory by typing: cd / Next, open the. :/var/www/html/xgplayer/events/"$subdir" -y It is important to note that batch does not accepts any parameters. ![]() Rsync -ah -e 'ssh -p 48180' /home/user/test This is how my file looks so far: #!/bin/bash sh file that a cronjob will run occasionally that does an automatic rsync. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |