Fermé

shell script expert

I have below script which will basically run various commands that i enter inside the quotes.

This needs to execute now as "root" user , currently it run as "bob" user which has "root" privilages by becoming root user with sudo su

Please let me know if you can make it without changing below code much.

#!/bin/bash

tmpdir=${TMPDIR:-/home/cloud-user}/output.$$

mkdir -p $tmpdir

count=0

while IFS= read -r host; do

ssh -n -o BatchMode=yes -q -o "StrictHostKeyChecking no" -i /home/cloud-user/keys/[login to view URL] ${host} 'hostname -f & command1 & command2' > ${tmpdir}/${host} 2>&1 &

count=`expr $count + 1`

done < '/home/cloud-user/servers/[login to view URL]'

while [ $count -gt 0 ]; do

wait $pids

count=`expr $count - 1`

done

echo "Output for hosts are in $tmpdir"

exit 0

NOTE:

on all hosts "bob" user exist and he can become root on all hosts without password

Script need to execute on 500 nodes all at once

All commands which are in quotes needs to be executed as "root" user. ('hostname -f & command1 & command2' )

on local host, it currently runs as my id "bob"

Compétences : Script Shell, Linux, Script Install, PHP, Python

en voir plus : calling shell script using bash, check system health using unix shell script, sending commands modem using shell script, need create report service web application using oracle, create exchange user html script, hardware fault alerts using shell script, script create domain user excel table, power shell script active directory create users excel, create ftp user using ssh linux, script read excel create ad user, shell script expert, shell script expert needed, shell script to create multiple user accounts in linux, shell script to create user accounts in linux, create html table using shell script, create table using shell script, create cron job using shell script, how to create graph using shell script

Concernant l'employeur :
( 1 commentaire ) Westerville, United States

Nº du projet : #23377372

16 freelance font une offre moyenne de $27 pour ce travail

TheInnoVibes

Hello, We are a hard-working web-development company We can develop cross-browser, W3C compliant good quality professional websites. We have gone through your requirement and have done this kind of work in the past. Th Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 2 jours
(800 Commentaires)
8.8
cyberloh

hello, i have 10+ years of linux administration experience though things aren't that clear for me in the task description. as i see - there's nothing to do in provided script itself, some details are missing i guess. i Plus

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(19 Commentaires)
6.0
debianguy

Hi. I can help you without problem. I can provide you with a basic bash script converting required user to root using sudo. Be advice, you need to configure sudo firts for required user. Open to questions

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(84 Commentaires)
5.5
goodwork20k

I am good in shell script along with automation and development, please let me know if you are good to award this project to me

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 2 jours
(36 Commentaires)
5.1
VarunUnix

HI, Do you mean the ssh command need to be executed as root through the script ? By the way, i didnt get a reason for you to do that as bob is having the sudo permission. Better you explain the problem you need to sol Plus

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(47 Commentaires)
5.3
aruaswin

Hi There!! I have been working as Linux Administrator for 6+ years and have written many shell scripts and Ansible Playbook for automating projects. I have been working in vRealize Automation tool which has various Blu Plus

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(8 Commentaires)
3.3
panditthecoder

Hi, Try replacing 'hostname -f & command1 & command2' with 'hostname -f & sudo command1 & sudo command2'. If it works, please feel free to assign the project to me and pay the milestone :-). I've put $10 because the f Plus

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(6 Commentaires)
3.5
adricabrelles

Hi I am a Senior admin with more than 15 years in shell programming. I can help you. Regards.

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(4 Commentaires)
2.6
AleksandarDikic

Hello. I have some experiences for similar projects with yours. I have rich experiences as a Python developer for 12 years. I have developed 250+ projects based Python and 7 of them are used for huge companies like Na Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 7 jours
(3 Commentaires)
1.9
TalentedDev111

Dear Client, How are you? I can start now. I am very interested in this project. I have rich experience in python with over 8 years of experience and very strong in this field. I can deliver you a wonderful result as y Plus

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(2 Commentaires)
1.9
EricJoseph2

Hello, I request you to award me this task since I am experienced with Linux bash scripts. I will provide documentation where required.

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 3 jours
(0 Commentaires)
0.0
Tejaeshwarrao

Hello, After reading over your project this looks like a perfect fit for my skill set. I have made many similar projects on this before. While I can assure you several things 1.I work extremely fast. 2.I bring fresh id Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 4 jours
(0 Commentaires)
0.0
sudhanshumall90

Hi, You don't need to change a single line in your code. While running your script itslef, you can define with which user your script should run. It is not even 5 mins jobs, you basically need to know the right comm Plus

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(1 Évaluation)
0.0
pmmyr

Hello , I am a software developer who can assist you in your project without changing a single line of the script.I can also show you a trick or two in the process so that you could be able to do it yourself. Thank yo Plus

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(0 Commentaires)
0.0
Brossfl

Hi , I have good experience to shell scripting. I would like to work on this project. Thanks. Brossfl.

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 7 jours
(0 Commentaires)
0.0
dp64828

Family

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(0 Commentaires)
0.0