Sponsored Content
Top Forums Shell Programming and Scripting Run a script before and after reboot automatically and send output to two locations. Post 303035000 by vbe on Friday 10th of May 2019 03:36:58 PM
Old 05-10-2019
Greetings and welcome to our forum
Quote:
, it will run right after power on .
depends what you call right after...
Without knowing your OS and its version no one will take the risk of giving you any advise, as start stop implementation is OS dependant
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to run a script automatically ?????

Hi All, How to run a script automatically using cronjob everyday from Monday to Friday 9A.M to 5P.M at an interval of ONE HOUR.I want the complete syntax means how to put in the cron job and there after. URGENTLY NEED HELP THANKS IN ADVANCE CHEERS Arunava (7 Replies)
Discussion started by: arunava_maity
7 Replies

2. UNIX for Dummies Questions & Answers

how to run a Script automatically

How to make a script run automatically using a cron?? i do not know abt cron...... if i have simple.sh file and i need this to run everyday at a particular time what needs to be done thanks in advance (4 Replies)
Discussion started by: hamsa
4 Replies

3. Linux

Run a script during reboot/startup

Hi all, i have a script in /etc/init.d directory. -rwxr-xr-x 1 root root 26 Mar 28 16:00 myscript I need it to run when my linux reboots/startup. However is it not being executed. Do i need to put in in the rc.local directory? (1 Reply)
Discussion started by: new2ss
1 Replies

4. Shell Programming and Scripting

How to run a script automatically

Hi All, How can i run a script every week automatically. Thanks & regards, Sam (5 Replies)
Discussion started by: sam25
5 Replies

5. UNIX for Dummies Questions & Answers

Script to automatically reboot to newly compiled kernel with fallback

Hi, I'm new here. Just started playing around with kernel compilation. I need a little bit of advice. I'm trying to do a bash script to automatically compile a kernel package and reboot to that new kernel by default, with fallback to the old kernel. So far, I'm getting stuck at the part... (0 Replies)
Discussion started by: tridus_08
0 Replies

6. Shell Programming and Scripting

How to automatically send a mail alert if the script errors out

I have a script like this, which calls other scripts from that script: #!/usr/ksh moveFiles.sh extract.sh readfile=/home/sample.txt cat $readfile | while read line do file= `echo $line|awk '{print $4}'` if ; then mv $file /home/temp_stage fi (4 Replies)
Discussion started by: ss3944
4 Replies

7. Shell Programming and Scripting

how to run a script using cron job and send the output as attachment via e-mail using unix

how to run a script using cron job and send the output as attachment via e-mail using unix. please help me. how my cron job entry should be? As of now my cron job entry is to run the script at specific time, 15 03 * * * /path/sample.sh | mail -s "Logs" email_id In the above entry, what... (8 Replies)
Discussion started by: vidhyaS
8 Replies

8. Shell Programming and Scripting

How to run script automatically on reboot as root user?

Hi friends,,, I am running one server on Ubuntu 12.04 LTS 32-bit, some times my pc restarts automatically, with no reason, I have a script to start server which requires root password. in this directory /myserver/start_server.sh How can I do this ? and some scripts I am having that I... (1 Reply)
Discussion started by: Akshay Hegde
1 Replies

9. Shell Programming and Scripting

How to run script automatically every 12 hour once?

Hi ! all, I have once script to remove temporary cache and temporary xml files looks like this, as it is taking more space, I would like to run automatically every 12 hour once, and then I want to receive some log as acknowledgement #!/bin/sh echo "Removing logs and temp files (typically... (4 Replies)
Discussion started by: Akshay Hegde
4 Replies

10. Shell Programming and Scripting

A shell script to run a script which don't get terminated and send a pattern from the output by mail

Hi Guys, I am very new to shell script and I need your help here to write a script. Actually, I have a script abc.sh which don't get terminated itself. So I need to design a script to run this script, save the output to a file, search for a given string in the output and if it exists send those... (11 Replies)
Discussion started by: Sambit Sahu
11 Replies
Moose::Cookbook::Roles::Restartable_AdvancedComposition(User Contributed Perl DocumentatMoose::Cookbook::Roles::Restartable_AdvancedComposition(3)

NAME
Moose::Cookbook::Roles::Restartable_AdvancedComposition - Advanced Role Composition - method exclusion and aliasing VERSION
version 2.0604 SYNOPSIS
package Restartable; use Moose::Role; has 'is_paused' => ( is => 'rw', isa => 'Bool', default => 0, ); requires 'save_state', 'load_state'; sub stop { 1 } sub start { 1 } package Restartable::ButUnreliable; use Moose::Role; with 'Restartable' => { -alias => { stop => '_stop', start => '_start' }, -excludes => [ 'stop', 'start' ], }; sub stop { my $self = shift; $self->explode() if rand(1) > .5; $self->_stop(); } sub start { my $self = shift; $self->explode() if rand(1) > .5; $self->_start(); } package Restartable::ButBroken; use Moose::Role; with 'Restartable' => { -excludes => [ 'stop', 'start' ] }; sub stop { my $self = shift; $self->explode(); } sub start { my $self = shift; $self->explode(); } DESCRIPTION
In this example, we demonstrate how to exercise fine-grained control over what methods we consume from a role. We have a "Restartable" role which provides an "is_paused" attribute, and two methods, "stop" and "start". Then we have two more roles which implement the same interface, each putting their own spin on the "stop" and "start" methods. In the "Restartable::ButUnreliable" role, we want to provide a new implementation of "stop" and "start", but still have access to the original implementation. To do this, we alias the methods from "Restartable" to private methods, and provide wrappers around the originals (1). Note that aliasing simply adds a name, so we also need to exclude the methods with their original names. with 'Restartable' => { -alias => { stop => '_stop', start => '_start' }, -excludes => [ 'stop', 'start' ], }; In the "Restartable::ButBroken" role, we want to provide an entirely new behavior for "stop" and "start". We exclude them entirely when composing the "Restartable" role into "Restartable::ButBroken". It's worth noting that the "-excludes" parameter also accepts a single string as an argument if you just want to exclude one method. with 'Restartable' => { -excludes => [ 'stop', 'start' ] }; CONCLUSION
Exclusion and renaming are a power tool that can be handy, especially when building roles out of other roles. In this example, all of our roles implement the "Restartable" role. Each role provides same API, but each has a different implementation under the hood. You can also use the method aliasing and excluding features when composing a role into a class. FOOTNOTES
(1) The mention of wrapper should tell you that we could do the same thing using method modifiers, but for the sake of this example, we don't. AUTHOR
Moose is maintained by the Moose Cabal, along with the help of many contributors. See "CABAL" in Moose and "CONTRIBUTORS" in Moose for details. COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Infinity Interactive, Inc.. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.16.2 2012-09-19 Moose::Cookbook::Roles::Restartable_AdvancedComposition(3)
All times are GMT -4. The time now is 02:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy