Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Shell script newbie- how to generate service log from shell script Post 303031584 by xiaogeji on Saturday 2nd of March 2019 07:18:42 AM
Old 03-02-2019
Hey bakunin,


Many thanks for your reply!


the following is my plan and let me know if anything doesnt make sense :


1. Ideally the script should print out the log file in the following format:
2019-02-26 09:15:00 +1100,Success,ntpd,restart 2019-02-26 09:16:00 +1100,Error,ntpd,other-activity

But if I am really stuck,as long as the "$(success status),$(service name),$(activity)" are in the output then it will still be fine, someone will extend the script later on..
2. and the fields that I want in the log should include, the last three fields are the minimum and the date is optional depending on the complexity:

$(date and time in fixed format), $(success status), $(service name), $(activity)



3. single log vs multiple logs: I shouldve clarified earlier that the only service I need to work on is ntpd. So a single log would be fine for me.


4. I am not sure if it will be more complicated to write a separate error log since I only need to focus on one service which is ntpd.



Let me know if it makes sense to move on to the next step. thanks again for your help!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

generate xml from a shell script

Hello! I would like to generate an xml file from the output of various commands generated from within a shell script (some will be in CDATA). At the moment the only solution I have come up with is echoing xml tags around the commands eg. echo "<bitism>" >> outputfile /usr/sbin/prtconf... (1 Reply)
Discussion started by: speedieB
1 Replies

2. Shell Programming and Scripting

Help - shell script newbie

My problem looks like it should have a simple solution but it seems that after many days of research I cannot find a good solution. What I have is an input file that contains lines of information. What I need is to extract specific information from that file. What I know is that somewhere in the... (2 Replies)
Discussion started by: eback
2 Replies

3. Shell Programming and Scripting

how do i generate random integer using only shell script

Hi All, I need to generate 4 digit random no using only shell script. Please help in this ASAP. Thanks in advance... Regards, sridhar. (1 Reply)
Discussion started by: sridhusha
1 Replies

4. Shell Programming and Scripting

Shell Script Help -I'm a newbie

Can someone help me write this shell script? I am completely new to shell and as a fun task my uncle has challenged me a problem (out of all other people). Basically, all he wants me to do is to create backup file in a folder that is named “disables.” This is what he said: create a shell script... (0 Replies)
Discussion started by: hotcutiepie05
0 Replies

5. Infrastructure Monitoring

Shell Script - Generate SNMP Traps

Good morning to you all I´m kinda of a noob to scripting, and my knowledge is still very basic: anyway, I´ve developed a small .sh script with the following purpose: - it will check a result file, checking if it has any values, or if it´s empty - if it´s empty it will send an email What... (0 Replies)
Discussion started by: zarahel
0 Replies

6. Shell Programming and Scripting

Shell Script for a newbie

Hello all, I want to write a shell script to list the contents of a directory and number them and write them to a file. For example, if I have a directory temp and the contents of the directory are alpha, beta and gamma. I want to write these filenames to a file "test" in a numbered manner. ... (7 Replies)
Discussion started by: grajp002
7 Replies

7. Shell Programming and Scripting

generate logfile in a shell script

Unix Gurus, I have a shell script which has few "echo" statements. I am trying to create a logfile where all the outputs of the echo statement sare stored. I will have to add this as the final step in the existing script so that everytime the script runs, a logfile is generated with all the... (1 Reply)
Discussion started by: shankar1dada
1 Replies

8. Shell Programming and Scripting

Shell script newbie, what is problem with my script?

Hello, Ubuntu server 11.10 can anybody help what is problem with my shell script? #!/bin/bash #script to find out currently logged on user is root or not. if ] then echo "You are super" else echo "You are awesome!" fi When I run script, I get following output ./uid: line 3: I... (4 Replies)
Discussion started by: kaustubh
4 Replies

9. Shell Programming and Scripting

Shell script to compare and generate a new file

Requirement is I have two files their format is File1 - input_file ----- tmp_value|3|number|| tmp_value1|3|alpha|| tmp_value2|6|alpha|AA AA| tmp_value3|15|number|000000005| tmp_value4|15|number|000000000000000| tmp_value5|11|alpha|bbbbbbbbbbb| tmp_value6|11|alpha|bb bb| input_file ... (4 Replies)
Discussion started by: greenworld123
4 Replies

10. Shell Programming and Scripting

Generate documentation for a shell script

Hi, I've written a shell script with proper intentation and commenting structure. However, I would like to generate documentation for the shell which I have written. Is there any tool as such to generate it like we have javagen/docgen ? Please help. Thanks, Arjun (0 Replies)
Discussion started by: arjun_arippa
0 Replies
ntp-wait(1)							   User Commands						       ntp-wait(1)

NAME
ntp-wait - Wait for ntpd to stabilize the system clock SYNOPSIS
ntp-wait [-flags] [-flag [value]] [--option-name[[=| ]value]] All arguments must be options. DESCRIPTION
ntp-wait will send at most num-tries queries to ntpd(8), sleeping for secs-between-tries after each status return that says ntpd(8) has not yet produced a synchronized and stable system clock. ntp-wait will do this quietly, unless the -v flag is provided. This can be useful at boot time, to delay the boot sequence until after ntpd -g has set the time. OPTIONS
-n number, --tries=number Number of times to check ntpd. This option takes an integer number as its argument. The default number for this option is: 100 The maximum number of times we will check ntpd to see if it has been able to synchronize and stabilize the system clock. -s secs-between-tries, --sleep=secs-between-tries How long to sleep between tries. This option takes an integer number as its argument. The default secs-between-tries for this option is: 6 We will sleep for secs-between-tries after each query of ntpd that returns "the time is not yet stable". -v, --verbose Be verbose. By default, ntp-wait is silent. With this option, ntp-wait will provide status information. -?, --help Display usage information and exit. -!, --more-help Pass the extended usage information through a pager. -v [{v|c|n --version [{v|c|n}]}] Output version of program and exit. The default mode is `v', a simple version. The `c' mode will print copyright information and `n' will print the full copyright notice. EXIT STATUS
One of the following exit values will be returned: 0 (EXIT_SUCCESS) Successful program execution. 1 (EXIT_FAILURE) The operation failed or the command syntax was not valid. 70 (EX_SOFTWARE) libopts had an internal operational error. Please report it to autogen-users@lists.sourceforge.net. Thank you. AUTHORS
Harlan Stenn NOTES
This document corresponds to version 4.2.8p13 of NTP. This manual page was AutoGen-erated from the ntp-wait option definitions. ntp (4.2.8p13) 20 Feb 2019 ntp-wait(1)
All times are GMT -4. The time now is 10:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy