Sponsored Content
Top Forums Shell Programming and Scripting How to redirect the messages from the script to console in Linux? Post 302924731 by sea on Wednesday 12th of November 2014 05:32:39 AM
Old 11-12-2014
You are already doing 'send the msg on console/terminal'.
In which case, you could execute this 'msg.sh' script at login.
For a bash based linux, this could be in: $HOME/.bashrc (note the . before the name)

Or do you ment to write to the logs?
Which in case of a regular service should already be done - see journalctl (1) for more details.

Otherwise you could always redirect your output to a file, which you can read at any time later.
To overwrite existing content:
Code:
echo "Service started" > /path/to/output_file

To append:
Code:
echo "Service failed" >> /path/to/output_file

Hope this helps
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

console redirect of progress bar

I'm trying to write a python wrapper around wget to show the progress bar on a gui application. Wget gives you a progress bar on command line, but how would I pipe that to some "tty" that's really just a variable I read, or am I going about it all wrong? When I try to just redirect the output to a... (1 Reply)
Discussion started by: unclecameron
1 Replies

2. Solaris

console redirect on dl365

anyone have any success with redirecting the console running sol10 x86 on a hp dl365? (0 Replies)
Discussion started by: pupp
0 Replies

3. Shell Programming and Scripting

How to redirect the output to multiple files without putting on console

How to redirect the output to multiple files without putting on console I tried tee but it writes to STDOUT , which I do not want. Test.sh ------------------ #!/bin/ksh echo "Hello " tee -a file1 file2 ---------------------------- $>./Test.sh $> Expected output: -------------------... (2 Replies)
Discussion started by: prashant43
2 Replies

4. Solaris

Command to redirect console to my tty?

Is there a utility built into Solaris that will allow me to see console messages from a tty? I've done a search and see that this is possible through software like ILOM, but I'm looking for a method to do this with built in utilities. For example, on AIX, I can use swcons `tty` (6 Replies)
Discussion started by: makodarear
6 Replies

5. 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

6. Shell Programming and Scripting

How to redirect the output of a cvs command to a file as well as the console.

Hi can anyone tell me how to redirect the ouput of a cvs command to a file as well as the console? i tried using cvs add <filename> | tee logFile cvs add <filename> 2>logFile 2>&1 All i could get is only on console or on file. Please help Thanks (2 Replies)
Discussion started by: ankitag2010
2 Replies

7. Shell Programming and Scripting

Redirect an output from a script to a file and display it at a console simultaneously

Hi, I'd like to redirect the STDOUT output from my script to a file and simultaneously display it at a console. I've tried this command: myscript.sh | tail -f However, it doesn't end after the script finishes running I've also tried this: myscript.sh | tee ~/results.txt But it writes... (3 Replies)
Discussion started by: wenclu
3 Replies

8. AIX

Console redirect to xmanager in AIX ?

Hello, Oracle PDF reports run only when you run the command # xhost + from the console, but if you run from the xmanager session , then report doesn't work running from windows pc using xmanager # xhost + access control disabled, clients can connect from any host # echo... (7 Replies)
Discussion started by: filosophizer
7 Replies

9. Linux

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 #!/bin/bash if then echo... (1 Reply)
Discussion started by: saku
1 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-JOURNAL-GATEWAYD.SERVICE(8)			 systemd-journal-gatewayd.service		       SYSTEMD-JOURNAL-GATEWAYD.SERVICE(8)

NAME
systemd-journal-gatewayd.service, systemd-journal-gatewayd.socket, systemd-journal-gatewayd - HTTP server for journal events SYNOPSIS
systemd-journal-gatewayd.service systemd-journal-gatewayd.socket /usr/lib/systemd/systemd-journal-gatewayd [OPTIONS...] DESCRIPTION
systemd-journal-gatewayd serves journal events over the network. Clients must connect using HTTP. The server listens on port 19531 by default. If --cert= is specified, the server expects HTTPS connections. The program is started by systemd(1) and expects to receive a single socket. Use systemctl start systemd-journal-gatewayd.socket to start the service, and systemctl enable systemd-journal-gatewayd.socket to have it started on boot. OPTIONS
The following options are understood: --help, -h Prints a short help text and exits. --version Prints a short version string and exits. --cert= Specify the path to a file containing a server certificate in PEM format. This option switches systemd-journal-gatewayd into HTTPS mode and must be used together with --key=. --key= Specify the path to a file containing a server key in PEM format corresponding to the certificate specified with --cert=. SUPPORTED URLS
The following URLs are recognized: /browse Interactive browsing. /entries[?option1&option2=value...] Retrieval of events in various formats. The Accept: part of the HTTP header determines the format. Supported values are described below. The Range: part of the HTTP header determines the range of events returned. Supported values are described below. GET parameters can be used to modify what events are returned. Supported parameters are described below. /machine Return a JSON structure describing the machine. Example: { "machine_id" : "8cf7ed9d451ea194b77a9f118f3dc446", "boot_id" : "3d3c9efaf556496a9b04259ee35df7f7", "hostname" : "fedora", "os_pretty_name" : "Fedora 19 (Rawhide)", "virtualization" : "kvm", ...} /fields/FIELD_NAME Return a list of values of this field present in the logs. ACCEPT HEADER
Accept: format Recognized formats: text/plain The default. Plaintext syslog-like output, one line per journal entry (like journalctl --output short). application/json Entries are formatted as JSON data structures, one per line (like journalctl --output json). See Journal JSON Format[1] for more information. application/event-stream Entries are formatted as JSON data structures, wrapped in a format suitable for Server-Sent Events[2] (like journalctl --output json-sse). application/vnd.fdo.journal Entries are serialized into a binary (but mostly text-based) stream suitable for backups and network transfer (like journalctl --output export). See Journal Export Format[3] for more information. RANGE HEADER
Range: entries=cursor[[:num_skip]:num_entries] where cursor is a cursor string, num_skip is an integer, num_entries is an unsigned integer. Range defaults to all available events. URL GET PARAMETERS
Following parameters can be used as part of the URL: follow wait for new events (like journalctl --follow, except that the number of events returned is not limited). discrete Test that the specified cursor refers to an entry in the journal. Returns just this entry. boot Limit events to the current boot of the system (like journalctl --this--boot). KEY=match Match journal fields. See systemd.journal-fields(7). EXAMPLES
Retrieve events from this boot from local journal in Journal Export Format[3]: curl --silent -H'Accept: application/vnd.fdo.journal' 'http://localhost:19531/entries?boot' Listen for core dumps: curl 'http://localhost:19531/entries?follow&MESSAGE_ID=fc2e22bc6ee647b6b90729ab34a250b1' SEE ALSO
systemd(1), journalctl(1), systemd-journald.service(8), systemd.journal-fields(7), NOTES
1. Journal JSON Format http://www.freedesktop.org/wiki/Software/systemd/json 2. Server-Sent Events https://developer.mozilla.org/en-US/docs/Server-sent_events/Using_server-sent_events 3. Journal Export Format http://www.freedesktop.org/wiki/Software/systemd/export systemd 208 SYSTEMD-JOURNAL-GATEWAYD.SERVICE(8)
All times are GMT -4. The time now is 04:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy