LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-04-2017, 08:46 AM   #1
andrew.comly
Member
 
Registered: Dec 2012
Distribution: Trisquel-Mini 7.0, Lubuntu 14.04, Debian lxde 8.0
Posts: 311
Blog Entries: 2

Rep: Reputation: 16
Question "at" bash command (cron/crontab) online examples don't work.


BASH - at/cron/crontab online examples don't work. '

I am reading Advanced Bash Scripting by Mendell Cooper. In this eBook there is a Chapter 16 External Filters, Programs and Commands. Within this chapter the author mentions the commands "at" briefly. Since he mentions this without an example nor exercise, it may be that this is either not important, too difficult for a regular person to learn. or too easy.

I also looked at the following sites, and none of their examples worked:
1) http://www.thegeekstuff.com/2010/06/...mand-examples/
2) https://bugs.debian.org/cgi-bin/bugr...cgi?bug=460514

However, it is really a practical idea to fire off a certain command or script at regular fixed/repeating times. Thus I would dare to ask for some real functioning examples on how to use this command. Moreover, I would like to play a BigBen sound everyday at both noon and midnight (iff I am currently logged in).

Attempt 01:
$ date
四 5月 4 15:34:41 CST 2017
$ at 15:35:30 /usr/local/bin/ClockBell.sh

Result 01:
syntax error. Last token seen: :
Garbled time


FYI
------------------------------------
1
ClockBell.sh's contents: '

#!/bin/bash
#Purpose: To play a sound like Big Ben

mplayer /usr/share/sounds/custom/BigBenRings150_clip.mp3
wait

exit 0
------------------------------------
2
My OS:
trisquel-mini 7.0

Last edited by andrew.comly; 05-04-2017 at 09:45 PM. Reason: clarity
 
Old 05-04-2017, 09:02 AM   #2
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,306
Blog Entries: 3

Rep: Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720
Try these:

Code:
$ echo /usr/local/bin/ClockBell.sh  | at 15:35

$ crontab -e

Last edited by Turbocapitalist; 05-04-2017 at 09:15 AM.
 
1 members found this post helpful.
Old 05-04-2017, 09:10 AM   #3
andrew.comly
Member
 
Registered: Dec 2012
Distribution: Trisquel-Mini 7.0, Lubuntu 14.04, Debian lxde 8.0
Posts: 311

Original Poster
Blog Entries: 2

Rep: Reputation: 16
Cool at [Solved]

I found how to use simple "at" commands

Success01: Fixed time, current date.
at 21:50 -f /usr/local/bin/ClockBell.sh
warning: commands will be executed using /bin/sh

Success02: Fixed time, future date.
at 21:55 May 4 2017 -f /usr/local/bin/ClockBell.sh

Success03:
at now + 1 min -f /usr/local/bin/ClockBell.sh

Last edited by andrew.comly; 05-04-2017 at 09:22 AM. Reason: complete
 
Old 05-04-2017, 09:13 AM   #4
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,306
Blog Entries: 3

Rep: Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720
The -f option reads in the commands what are inside the given file, so that will only work with scripts.

Code:
man at
 
1 members found this post helpful.
  


Reply

Tags
bash, cron, crontab



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bash: why don't my "double if's" ever work? L_Carver Linux - Newbie 6 03-03-2017 01:10 PM
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 10:18 PM
BASH problems: "configure, make, make install" commands don't work ditch* Linux - General 3 07-19-2005 04:37 PM
chrooted user: "write" and "talk" don't work. ldp Linux - Software 2 04-12-2005 02:05 AM
"depmod" and "modprobe" commands don't work The1PatO Fedora 7 06-10-2004 12:10 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration