StephenChan's Tech Space 潜心修炼

28Jan/104

Crontab

Intro:

crontab  is  the  program used to install, deinstall or list the tables used to drive the cron(8) daemon in Vixie Cron.  Each user can have their own crontab, and though these are files in /var/spool/cron/crontabs, they are not intended to be edited directly.

If the /etc/cron.allow file exists, then you must be listed therein in order to be allowed to use this command.  If the /etc/cron.allow file does not exist  but  the  /etc/cron.deny  file does exist, then you must not be listed in the /etc/cron.deny file in order to use this command.  If neither of these files exists, then depending on site-dependent configuration parameters, only the super user will be allowed to use this command, or all  users will be able to use this command. For standard Debian systems, all users may use this command.

Usage:

crontab [ -u user ] file
crontab [ -u user ] { -l | -r [ -i ] | -e }

The -l option causes the current crontab to be displayed on standard output. See the note under DEBIAN SPECIFIC below.

The -r option causes the current crontab to be removed.

The  -e option is used to edit the current crontab using the editor specified by the VISUAL or EDITOR environment variables.  After you exit from the  editor, the modified crontab will be installed automatically.  If  neither  of  the  environment  variables  is  defined,  then  the  default  editor /usr/bin/editor is used.

The -i option modifies the -r option to prompt the user for a 'y/Y' response before actually removing the crontab.

Filed under: Linux Continue reading
25Jan/100

Debian Package系统学习小结

这里先介绍一下创建repository的步骤和apt-get命令的相关数据流程,以后有时间再将其他的细节补充。

一、创建repository

  • locate root direcotry, create pool
  • move binary and source packages to pool
  • generate Packages, Sources file (dpkg-scanpackages, dpkg-scansources)
  • create Release file and signature Release.gpg (apt-ftparchive, gpg)
  • publish repository : http, ftp, file

下面这个是创建repository的简单脚本:

Filed under: Linux Continue reading
24Jan/100

Python项目生成Debian包小记

一、安装打包需要的工具

apt-get install dh-make debhelper devscripts cdbs build-essential fakeroot python2.5-dev

在对Python源代码进行打包的时候,需要用于打包的专用命令,例如创建文件模板、加入man文件、生成Debian包使用的md5sum文件、将所有的文件整合成“*.deb”文件等,debhelper库的安装提供了一系列小工具来完成这些任务。

dh-make是一个方便对源代码进行Debian化的工具,主要体现在根据当前的Debian系统为我们自动生成一系列格式化的build files,省去我们手动创建的功夫。

Debian包本身的所有者是root,同时也需要root权限来安装的,为了使非root权限的开发者也能够创建Debian包,fakeroot命令使在创建文件的时候让非root用户获取到root的权限,仅仅在创建文件的时候。

传统的makefile文件是需要自己写一系列的命令来完成打包的过程,包括检查权限、调用打包命令等等,为了减轻打包的工作,使用cdbs(Common Debian Build System)为开发人员处理打包的细节和检查相关的配置。

python2.5-dev的加入是为了能够编译Python源代码中的extensions,可以根据当前系统的python版本(如X.Y)来下载相应的pythonX.Y-dev包。

安装devscripts可以获得许多的辅助性工具,有利于提高制作Debian包的效率。比如使用dch命令来编辑changelog文件、使用debclean清除包创建过程中生成的各种临时文件等等。

创建Debian软件包的环境主要在Debian操作系统上。

Filed under: Linux Continue reading