Cron job without crontab in linux - linux

I have moodle installation on linux platform.
I want to set up a cron job for sending e-mails to users.
I've read about using crontab program and configuring it.
But according to my client requirements I want to execute it WITHOUT using crontab.
Can anybody help me on this?
Thanks in advance... :)

Have you tried while, loop?
Example:
while true;
do echo "Hello" ;
sleep 100;
done &
So you can enter your command / email script after do, or you can make a script for email process and called after do,
Note: kindly add end & symbol, so this will get execute in background.
Thanks.

Related

Bash Console commands (Codeship console): how to exit from current "inputs"

Excuse me for the imprecisions in the question but I don't know how it is called what I'm trying.
In the CodeShip documentation is stated that I can pass to the SSH CodeShip debug build some commands using their command line application.
So, I should do something like cs setup-commands and I'm prompted with this:
rof#railsonfire_unique_string_sfivbe8bwucb9:~$ cs setup-commands
Your setup commands:
phpenv local 5.6
phpenv local 5.6
In Your setup commands: I put my commands but then, how can I "execute" them?
The second phpenv local 5.6 line is wrote by the command-line application. I think is something to signal the command were taken, but the behavior is ever the same: I remain "blocked" in the command setup-commands. After setting setup-commands I have to set also test-commands but all the things I write are taken by Your setup commands:.
How can I "submit and exit" the command setup-commands to then launch test-commands and set those other commands?
I think this is something related to Bash, but I don't know what it is...
And I don't know which is the correct terminology.
Can someone help me with this? So I will can also update my question to be more precise. Thank you.
Not sure about your case, but usually the input is considered finished, when th input file (in your case stdin) is closed.
Try to press Ctrl+D, it should end your input (and so signal the program hat you stopped typing for this session)

Waiting for bash script job to finish before starting another

I have a feeling that this isn't going to be as simple as I'm hoping it will be..
I understand the concept of using & and then wait in bash scripts but can this be applied to the same script being run multiple times while the first process still hasn't finished?
I'll try to explain what I mean better.
Say I have this script :
#/!/bin/bash
COMPLETE="download complete"
wget /root/downloads/ http://linktoareallymassivefile.wav &
wait;
echo $COMPLETE
Now forget the fact that running this actual script would just overwrite the previously downloaded file for a moment.
I execute it, it starts downloading, then I execute it again but I'd like the first process to finish before the second one starts.
So would something like this work? :
#/!/bin/bash
wait;
COMPLETE="download complete"
wget /root/downloads/ http://linktoareallymassivefile.wav &
wait;
echo $COMPLETE &
I'm very much doubting that it would, but I think you can see what I'm asking.
Or, as I fear, is there a much more complicated queue based solution needed in this situation?
Each time you run the script, a new process is started.
Each process is independent of every other process. wait will not affect any other script.
So either modify the script to consolidate all the commands:
wget /root/downloads/ http://linktoareallymassivefile1.wav
wget /root/downloads/ http://linktoareallymassivefile2.wav
Or make a new script to call the original script:
script.py
script.py
If you don't use & then the next command will not be executed until the first one finishes.
If you simply don't use & to push a process to background, and remove the wait, execution of wget will simply take as long as it takes.

Automatically pass a value to a script menu for automation's sake in Bash/KSH

Trying to make a small script and cron job it in order to automate a task. Said script runs another script which has already been created, grabs the output, emails to specified recipients, and cleans up the output. I've got it almost down however am running into one major issue. The script that mine is running has a menu on the outset. That is to say, running the script by itself manually, i would have to select option 1 in order to get the output i want (the only other option, 2, is quit.)
How can I automatically enter (or simulate entering) the value 1 into the other script, so it does not hang when in a cron job waiting for user input?
Is there a sane way to do this?
Thanks in Advance.
You could try something as simple as using yes | command if answering yes is all that is needed. Otherwise you probably want to use expect to drive the imaginary keyboard for you.
http://expect.sourceforge.net/
Using autoexpect to record your session is a convenient way to come up with rough draft expect scripts as well.

What's the difference between crontab and cronjob?

This question may sound incredibly stupid, but if I don't ask I'll never know...
All the tasks setting I do is always by using "crontab". I heard the term "cronjob" somewhere. Is it another tool or just a name for something in "crontab"?
A cronjob is just a single entry in a crontab, that's all.
The cronjob is what you put into your crontab.
crontab is the actual command line entry that is used to kick off a cron job (not cronjob).
to create a cron job, do the following
crontab -e
And then fill in the cron syntax for the scripts/programs you want to run at a specific "cron'ed" interval.
Try playing in the cron sandbox - lets you try out combinations of crontab timing values and gives you a list of when the job would run. www.dataphyx.com

automatic recrawl sites in nutch 1.4?

I want to recrawl my sites 3 times a day. I know I should write a script for this but i don't know how? and i don't know how run the script ?
can someone explain this step by step
thanks
Write a shell script. Below structure can be used:
while loop
......command which u use to invoke nutch once
......sleep for few hours
end loop
Run this script using nohup or screen session. It will work great !!

Resources