Executing Host Commands

Slides:



Advertisements
Similar presentations
Shell Programming, or Scripting Shirley Moore CPS 5401 Fall August 29,
Advertisements

© 2012 IBM Corporation Tivoli Workload Automation Informatica Power Center.
Monitoring and Troubleshooting Chapter 17. Review What role is required to share folders on Windows Server 2008 R2? What is the default permission listed.
Python Mini-Course University of Oklahoma Department of Psychology Day 1 – Lesson 2 Fundamentals of Programming Languages 4/5/09 Python Mini-Course: Day.
Agenda  Terminal Handling in Unix File Descriptors Opening/Assigning & Closing Sockets Types of Sockets – Internal(Local) vs. Network(Internet) Programming.
Network Tools TCP/IP interface configuration query - MAC (HW) address and IP address – Linux - /sbin/ifconfig – MS Windows – ipconfig/all 1.
Checking Network/Port Connectivity using Kaseya Agent Procedures Developed By: Emmanuel Giboyeaux Advisor : Dr. S. Masoud Sadjadi School of Computing and.
Chapter Four UNIX File Processing. 2 Lesson A Extracting Information from Files.
Advanced UNIX Shell Dr. Tran, Van Hoai Faculty of Computer Science and Engineering HCMC Uni. of Technology
ITIS 1210 Introduction to Web-Based Information Systems Chapter 23 How Web Host Servers Work.
Client – Server Application Can you create a client server application: The server will be running as a service: does not have a GUI The server will run.
Labs 1.1: Mensaje. Step 1: Get Started Login: – Username: nombre/cc5212 – Password on board – C:/Program.
Quiz 15 minutes Open note, open book, open computer Finding the answer – working to get it – is what helps you learn I don’t care how you find the answer,
Website s Azure Websites is an enterprise class cloud solution for developing, testing and running web apps. Azure Websites allows you to focus on what.
Illustration of a Visual Basic Program Running an Ada Program 1 by Richard Conn 11 September 1999.
Shell Interface Shell Interface Functions Data. Graphical Interface Graphical Interface Command-line Interface Command-line Interface Experiments Private.
RT-LAB Electrical Applications 1 Opal-RT Technologies Use of the “Store Embedded” mode Solution RT-LAB for PC-104.
Microsoft® Desktop Deployment Assistance Program 5: USMT Drill Down Thomas Lee Chief Technologist QA plc
POWERSHELL BASICS. BACKGROUND  Powershell is a task automation and scripting language based off the.NET framework  It provides the user full access.
Agenda Networking with Linux & UNIX OS –Overview –Setup –Common Utilities.
1 Tips for the assignment. 2 Socket: a door between application process and end- end-transport protocol (UDP or TCP) TCP service: reliable transfer of.
 Last lesson, the Windows Operating System was discussed along with the Windows command shell  Unix is a computer operating system, that similarly manages.
Review Please turn in your homework and practicals Packages, installation, rpm command Apache – Quick and easy way to set up a web server to play around.
1 Lecture 7 Introduction to Shell Scripts COP 3353 Introduction to UNIX.
Wouter Verkerke, NIKHEF 1 Using ‘stoomboot’ for NIKHEF-ATLAS batch computing What is ‘stoomboot’ – Hardware –16 machines, each 2x quad-core Pentium = 128.
Agenda Customizing a Unix/Linux account Environment Introduction to Start-up Files (.bash_profile,.bashrc,.profile,.kshrc) Safe Methods for Changing Start-up.
Chapter 5e.  Upon completion of this chapter, you should be able to:  Find IP configuration settings on Windows & Linux  Troubleshoot IP configuration.
Job Management Beijing, 13-15/11/2013. Overview Beijing, /11/2013 DIRAC Tutorial2  DIRAC JDL  DIRAC Commands  Tutorial Exercises  What do you.
1 Dr. Tom Hicks Computer Science Department Trinity University 1.
Windows Server 2003 { First Steps and Administration} Benedikt Riedel MCSE + Messaging
PDO Database Connections
GRID COMPUTING.
Troubleshooting ip Chapter 5e.
Lecture 7 Introduction to Shell Programming
Lecture 7 Introduction to Shell Scripts COP 3353 Introduction to UNIX.
Python Lesson 12 Mr. Kalmes.
Linux 101 Training Module Linux Basics.
Lab #1 ,Ipconfig & ping commands
Network Tools and Utilities
UNIX Introduction History Main Features UNIX Operating System
LINUX System : Lecture 5 (English-Only Lecture)
Troubleshooting IP Communications
PDO Database Connections
CSE 303 Concepts and Tools for Software Development
Basic switch and router configuration
What is Bash Shell Scripting?
Configuring a Router Module 3 Semester 2.
PDO Database Connections
(Chapter 2) John Carelli, Instructor Kutztown University
SSH SSH is “Secure SHell” Secure, compressed, widely supported, fast
MySQL Web Application Connecting to a MySQL database
PDO Database Connections
IOTA HOW TO START BUILDING.
IRLP Remote Node Control
Networking Lab.
Michael P. McCumber Task Force Meeting April 3, 2006
gLite Job Management Christos Theodosiou
Windows Server Administration Fundamentals
Introduction to Client/Server Computing
Troubleshooting ip Chapter 5e.
NodeJS, Variables, Input/Output (I/O)
Lab 4: Introduction to Scripting
Executing Host Commands
Lab 6: Process Management
MySQL Web Application Connecting to a MySQL database
NodeJS, Variables, Input/Output (I/O)
CST8177 Scripting 2: What?.
DOS Commands Damian Gordon.
C++ Final Presentation.
Networking Lab.
Presentation transcript:

Executing Host Commands MIS 3406 Department of MIS Fox School of Business Temple University

Why Execute Host Commands Why would you want to execute host commands within code? Automate repetitive tasks Moving data Monitoring systems Backups DevOps Automated operations Automated testing Automated migration of code and data Dev  QA  Prod

What do you need to be able to do? Execute a command Capture and process the output Stdout – Stderr – Capture the “Exit Code” (a.k.a. “Return Code”) Conditional execution of code based on results of the host command

Execute a command at the command line… Arguments 1, 2 and 3 stdout

Let’s execute it within NodeJS… Setup .spawnSync stdout Command Arguments 1, 2 and 3 stderr Exit Code

How about a bad command… Setup .spawnSync stdout Command Arguments 1, 2 and 3 stderr Exit Code

OS Command (not a .exe) Command Arguments Need a Shell stdout stderr Exit Code

HostCommandWithExe.js Get your first program running that executes a host command with an exe.

HostCommandWithoutExe.js Get your first program running that executes a host command without an exe.

MyPing.js Write a script that is passed the name of a node to ping which then pings that node, captures the output. If the Exit Code is 0 displays the message “The node is reachable” and just the “Reply” line from stdout. If the Exit Code is 1 the script displays the message “The node is not reachable”.

MyDir.js Write a script that uses the “DIR” command to show all of the files with an extension of “.js” in the current directory and captures the output. Display just the file names of each “.js” file in the directory.

WhoAmI.js Write a script that executes the “set” command and captures the output. Display the user that is currently logged on by finding and parsing the “USERNAME=“ string in the output.

MyHostName.js Write a script that executes the hostname command and captures the output. Display the string, “The name of my computer is hostname” where hostname contains the name that was returned by the hostname command

MyIPAddress.js Write a script that executes the “IPCONFIG /ALL” command and captures the output. Display the string, “My IP address is xxx.xxx.xxx.xxx” where “xxx.xxx.xxx.xxx” is the IP address returned from the “IPCONFIG /ALL” command.

LookuoIPAddress.js Write a script that is passed the name of a server or website like www.temple.edu and uses the nslookup command to look up the IP address of this server or website. Display the IP address of this server or website so it looks like: The IP address of www.temple.edu is 155.247.166.60