at 命令怎么用?(okay)

sh/bash/dash/ksh/zsh等Shell脚本
回复
头像
iblicf
帖子: 3766
注册时间: 2007-01-15 17:15

at 命令怎么用?(okay)

#1

帖子 iblicf » 2007-06-07 17:50

我总是忘了煤气灶上烧的水,壶已经变形了

刚才想自制一个闹钟:

代码: 全选

weiyh@MyPC: at now + 10 minutes mplayer ~/Examples/ubuntu\ Sax.ogg 
syntax error. Last token seen: m
Garbled time
怎么也搞不定,。。。是不是at 有bug???????
上次由 iblicf 在 2007-08-30 22:13,总共编辑 2 次。
头像
iblicf
帖子: 3766
注册时间: 2007-01-15 17:15

#2

帖子 iblicf » 2007-06-07 18:00

crontab 可以
头像
iblicf
帖子: 3766
注册时间: 2007-01-15 17:15

#3

帖子 iblicf » 2007-06-07 19:52

没有人关心我的壶?
thword
帖子: 119
注册时间: 2007-04-09 12:19

#4

帖子 thword » 2007-06-07 21:33

$ at now + 10 minutes
at> mplayer ~/Examples/ubuntu\ Sax.ogg
at> #输入Ctrl+D
头像
iblicf
帖子: 3766
注册时间: 2007-01-15 17:15

#5

帖子 iblicf » 2007-06-08 0:43

thx ,不过这么弄比cron还麻烦了,,不用它了
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#6

帖子 eexpress » 2007-06-08 9:39

at有他的好处的。自动清除,适合一次使用的场合。时间格式非常人性和灵活。要不为什么会存在呢?
● 鸣学
头像
iblicf
帖子: 3766
注册时间: 2007-01-15 17:15

#7

帖子 iblicf » 2007-06-09 23:29

'echo "/mplayer ~/Examples/ubuntu\ Sax.ogg" | at now + 10 minutes
我试了一下,这样可以,那就能弄成alias 了,, :)
antonym55
帖子: 353
注册时间: 2007-04-03 9:52
联系:

#8

帖子 antonym55 » 2007-06-09 23:58

iblicf 写了:没有人关心我的壶?
换个有哨的壶
zanpen2000
帖子: 7
注册时间: 2008-03-16 7:35

#9

帖子 zanpen2000 » 2008-03-17 2:20

antonym55 写了:
iblicf 写了:没有人关心我的壶?
换个有哨的壶
哈哈,好办法!
头像
bzhao
帖子: 250
注册时间: 2008-07-05 2:15
系统: XUbuntu

Re: at 命令怎么用?(okay)

#10

帖子 bzhao » 2009-09-09 10:05

iblicf 写了:我总是忘了煤气灶上烧的水,壶已经变形了

刚才想自制一个闹钟:

代码: 全选

weiyh@MyPC: at now + 10 minutes mplayer ~/Examples/ubuntu\ Sax.ogg 
syntax error. Last token seen: m
Garbled time
怎么也搞不定,。。。是不是at 有bug???????
use the command format like this:
create a file and put your command in it. and then run command:
$at now + 10 minutes -f a_file

顺便: 忘了煤气灶上水壶很危险,因为煤气瓶子如果温度太高就会 Boon Boon.... 建议你买个温度煤气报警器。

//if you still have the same issue
//run command as below
$ pstree |grep atd || sudo /etc/init.d/atd start
//then try what you have done again
上次由 bzhao 在 2009-09-09 10:30,总共编辑 2 次。
头像
c\nc
帖子: 231
注册时间: 2007-12-25 12:51

Re: at 命令怎么用?(okay)

#11

帖子 c\nc » 2009-09-09 10:11

这种简单要求,弄个sleep就行了吧:

sleep 300 && ...
tusooa
帖子: 6548
注册时间: 2008-10-31 22:12
系统: 践兔
联系:

Re: at 命令怎么用?(okay)

#12

帖子 tusooa » 2009-09-10 19:04

代码: 全选

>> cat ~/bin/timetools           
#!/bin/bash                      
#                                
x="false"                        
[ -z $1 ] && x="true"            
[ -z $2 ] && x="true"            
[ -z $3 ] && x="true"            
function help                    
{                                
    echo "用法:timetools [ 小时 分钟 秒 ] [ -h | --help ]"
}                                                          
case $1 in                                                 
    -h)                                                    
        help                                               
        exit 0;;                                           
    --help)                                                
        help                                               
        exit 0;;                                           
    [0-9][0-9])                                            
        hr=$1;;                                            
    [0-9])                                                 
        hr="0$1" #一位数处理                               
        ;;                                                 
    *)                                                     
        if [ "$x" = "false" ] ; then                       
            echo '用法错误!'                              
            help                                           
            exit 1                                         
        fi;;                                               
esac                                                       

case $2 in
    [0-9][0-9])min=$2;;
    [0-9])min="0$2";;  
    *)                 
        if [ "$x" = "false" ] ; then
            echo '用法错误!'       
            help                    
            exit 1                  
        fi;;                        
esac                                
case $3 in                          
    [0-9][0-9])sec=$3;;             
    [0-9])sec="0$3";;               
    *)                              
        if [ "$x" = "false" ] ; then
            echo '用法错误!'       
            help                    
            exit 1                  
        fi;;                        
esac                                
if [ "$x" = "true" ] ; then         
    echo "输入小时: "               
    read hr                         
    case $hr in                     
    [0-9][0-9]);;                   
    [0-9])                          
        hr="0$hr" #一位数处理       
        ;;                          
    *)                              
        if [ "$hr" != "" ] ; then   
            echo '用法错误!'       
            help                    
            exit 1                  
        fi;;                        
esac                                

    echo "输入分钟: "
    read min
    case $min in
    [0-9][0-9]);;
    [0-9])min="0$min";;
    *)
        if [ "$min" != "" ] ; then
            echo '用法错误!'
            help
            exit 1
        fi;;
    esac
    echo "输入秒:   "
    read sec
    case $sec in
    [0-9][0-9]);;
    [0-9])sec="0$sec";;
    *)
        if [ "$sec" != "" ] ; then
            echo '用法错误!'
            help
            exit 1
        fi;;
    esac
fi
t="$hr:$min:$sec" # 't' is chort of 't'ime
while : ; do
    ct=`date +%k:%M:%S` # 'ct' is chort of 'c'urrent 't'ime
    if [ "$t" = "$ct" ] ; then
        break
    fi
    sleep 1
done
kdialog --msgbox "计时结束"
#dialog --msgbox "计时结束" 10 10
exit 0

代码: 全选

] ls -ld //
回复