我现在尝试停止当前命令并立即每小时重新启动它我只能通过
重新启动它while true; do homebridge; sleep 3600; done
这让我每小时运行命令homebridge一次,但在do homebridge之前我想停止“homebridge”命令,所以它每小时重启一次。
答案 0 :(得分:1)
您需要在后台运行该命令,以便脚本可以继续运行而无需等待它退出。使用public class BadgedDrawerArrowDrawable extends DrawerArrowDrawable {
/**
* @param context used to get the configuration for the drawable from
*/
public BadgedDrawerArrowDrawable(Context context) {
super(context);
setColor(context.getResources().getColor(R.color.colorAccent));
}
@Override
public void draw(Canvas canvas) {
super.draw(canvas);
Paint paint = new Paint();
paint.setStyle(Paint.Style.FILL);
paint.setColor(Color.RED);
paint.setTextSize(60);
canvas.drawText("!", canvas.getWidth() - 60, 25, paint);
}
}
获取后台进程的PID。
actionBarDrawerToggle.setDrawerArrowDrawable(new BadgedDrawerArrowDrawable(activity));