Sponsored Content
Operating Systems Linux Linux extacting msg from script to console Post 302924708 by saku on Wednesday 12th of November 2014 03:06:20 AM
Old 11-12-2014
Linux extacting msg from script to console

how to get the outout from script to console.

i am running one script msg.sh using cron job every suday midnight. as soon as i logged in i want to see the staus is service started or service failed on console.

what command i need to add to script ?

msg.sh
Code:
#!/bin/bash
if [ -e /user/script/$start.sh]
then 
   echo "starting  service"
else
   echo " service not started" 
   echo " Please check the start.sh file or manuly start the service" 
fi

if i login with root credentials @12.36.34.123 with passwd
Code:
username:root
passwd:abc

i once i logged in linux service started or service failed ( out put of the script ) should be printed on console.

how to check or how to extract messages in linux from var/log/message to current console


Moderator's Comments:
Mod Comment Please use code tags next time for your code and data. Thanks

Last edited by vbe; 11-12-2014 at 05:11 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Starting up linux to Console

How do i start linux without going straight into X window enviroment, but into the console instead, and also, how do i get back in ? (2 Replies)
Discussion started by: stealthdestroyr
2 Replies

2. UNIX for Dummies Questions & Answers

connecting to a database through a script...if not give an error msg

Hello , i have a problem in writing the shell script.. i have a script already written n just need to make a change in which when the script is not able to connect to the database ..it should print an error msg on the screen. I have already seen previous posts on how to connect to the... (3 Replies)
Discussion started by: sommer_queen
3 Replies

3. Red Hat

Doubt on Linux console

Can anyone explain me the usage of momentary press, press and hold, Reset.. I usually use cold boot option which is used to boot the system. Any help on the other options is really helpful thanks in advance (5 Replies)
Discussion started by: rogerben
5 Replies

4. UNIX for Dummies Questions & Answers

Windows to Linux remote console using VNC brings up blank console screen with only mouse pointer

:confused:Hi This was installed on the Linux box a few weeks back by a guy that no longer works for us. All worked fine until last week. Now when we connect its just a blank screen with no icons. I get a whole bunch of errors when starting the service too: Tue Feb 23 14:29:45 2010 ... (1 Reply)
Discussion started by: wbdevilliers
1 Replies

5. Red Hat

Linux console

Dear All, I have some Linux Servers in Data Center. I can access those servers through Telent or Putty. But If i want to work on the console I cannot do that. How to configure Console access for my Linux Server , So that I can work on the Console if it goes in to Single User mode. ... (2 Replies)
Discussion started by: jegaraman
2 Replies

6. UNIX for Dummies Questions & Answers

Msg before exiting pseudo-console

Hi! I want to display a message when I leave a pseudo-console (/dev/ptsX: konsole, xterm) e.g "Bye! There's still 3 pts open and 3 background processes" I can do it in login-terminals (via .bash_logout) but not in a non-login... Any ideas? (5 Replies)
Discussion started by: funyotros
5 Replies

7. Shell Programming and Scripting

My script is working but why do I get this msg?

Hi, I have a script to determine the max memory to set a worker to start up at. The variable will need to end up being "-Xmx512m" or "-Xmx256m" or "-Xmx768m." Everything works fine BUT when I set the "MEMORY" variable I get the "Cmmand not foundine 40: -Xmx512m" msg though the variable is the... (5 Replies)
Discussion started by: vsekvsek
5 Replies

8. UNIX for Dummies Questions & Answers

Warning msg from .sh script to web user?

Hello out there, I got a script that stops and restarts a webapp. I would like to be able to send warning reminders to the webusers as a warning like 5 minutes before it happens. Can I do this an if so how? (1 Reply)
Discussion started by: vsekvsek
1 Replies

9. Shell Programming and Scripting

How to redirect the messages from the script to console in Linux?

msg.sh #!/bin/bash if then echo "starting service" else echo " service not started" echo " Please check the start.sh file or manuly start the service" fi if i login with root credentials @12.36.34.123 with passwd username:root passwd:abc once i login into linux pc... (6 Replies)
Discussion started by: saku
6 Replies

10. UNIX for Beginners Questions & Answers

Linux Console for Interactive Input Script

Hi there, How do I enter command to the interactive console. I was able to do it via the first line. What if I have more lines to input into the interactive console from line 3 onwards. Is there a more easier way? (echo -e "load openvas" ; echo -e "openvas_help") | msfconsole ... (4 Replies)
Discussion started by: alvinoo
4 Replies
SYSTEMD-ASK-PASSWORD-CONSOLE.SERVICE(8) 	       systemd-ask-password-console.service		   SYSTEMD-ASK-PASSWORD-CONSOLE.SERVICE(8)

NAME
systemd-ask-password-console.service, systemd-ask-password-console.path, systemd-ask-password-wall.service, systemd-ask-password-wall.path - Query the user for system passwords on the console and via wall SYNOPSIS
systemd-ask-password-console.service systemd-ask-password-console.path systemd-ask-password-wall.service systemd-ask-password-wall.path DESCRIPTION
systemd-ask-password-console.service is a system service that queries the user for system passwords (such as hard disk encryption keys and SSL certificate passphrases) on the console. It is intended to be used during boot to ensure proper handling of passwords necessary for boot. systemd-ask-password-wall.service is a system service that informs all logged in users for system passwords via wall(1). It is intended to be used after boot to ensure that users are properly notified. See the developer documentation[1] for more information about the system password logic. Note that these services invoke systemd-tty-ask-password-agent(1) with either the --watch --console or --watch --wall command line parameters. SEE ALSO
systemd(1), systemd-tty-ask-password-agent(1), wall(1) NOTES
1. developer documentation https://www.freedesktop.org/wiki/Software/systemd/PasswordAgents systemd 237 SYSTEMD-ASK-PASSWORD-CONSOLE.SERVICE(8)
All times are GMT -4. The time now is 04:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy