Case: Customer have appliance from vendor running Linux. Customer have no access (restricted by agreement with vendor) to scheduler on server. Customer want periodically gather some information from applience and use it.
Solution: Create shell script on Linux server, owned by customer. Schedule it on customers server. In mentioned script use remote execution to gather required information from applience.
Shell script fragment:
sshpass -p 'pass1' ssh -t -p 2022 [email protected] 'echo pass2 | sudo -S python /usr/share/super_cool_script.py | grep some_data' | tr -s " " | cut -d " " -f 6 | sed 's/\.//g' > local_data_file
What script do: connect to remoter server via ssh and port 2022. Use user1 and pass1 to authenticate during this process. On remote server gain root-leve access with sudo command and password pass2. Execute python script on remote server and select only some rows from feedback and transfer them to local server. Get selected data and strip it from unnesessary columns. Save data to file.