fossilcons 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806
  1. .TH FOSSILCONS 8
  2. .SH NAME
  3. fossilcons \- fossil console commands
  4. .SH SYNOPSIS
  5. .B
  6. con /srv/fscons
  7. .PP
  8. .PD 0.1
  9. .B .
  10. .I file
  11. .PP
  12. .B 9p
  13. .I T-message
  14. ...
  15. .PP
  16. .B dflag
  17. .PP
  18. .B echo
  19. [
  20. .B -n
  21. ]
  22. [
  23. .I arg
  24. ...
  25. ]
  26. .PP
  27. .B listen
  28. [
  29. .B -d
  30. ]
  31. [
  32. .I address
  33. ]
  34. .PP
  35. .B msg
  36. [
  37. .B -m
  38. .I nmsg
  39. ]
  40. [
  41. .B -p
  42. .I nproc
  43. ]
  44. .PP
  45. .B uname
  46. .I uname
  47. [
  48. .I uid
  49. |
  50. .BI : uid
  51. |
  52. .BI % newname
  53. |
  54. .BI = leader
  55. |
  56. .BI + member
  57. |
  58. .BI - member
  59. ]
  60. .PP
  61. .B users
  62. [
  63. .B -dw
  64. |
  65. .I file
  66. ]
  67. .PP
  68. .B srv
  69. [
  70. .B -dp
  71. ]
  72. .I name
  73. .sp
  74. .PP
  75. .B fsys
  76. .I name
  77. .PP
  78. .B fsys
  79. .I name
  80. .B config
  81. .I device
  82. .PP
  83. .B fsys
  84. .I name
  85. .B venti
  86. .B -d
  87. |
  88. [
  89. .B -r
  90. ]
  91. [
  92. .I host
  93. ]
  94. .PP
  95. .B fsys
  96. .I name
  97. .B open
  98. [
  99. .B -APWr
  100. ]
  101. [
  102. .B -c
  103. .I ncache
  104. ]
  105. .PP
  106. [
  107. .B fsys
  108. .I name
  109. ]
  110. .B close
  111. .PP
  112. .B fsys
  113. .I name
  114. .B unconfig
  115. .sp
  116. .PP
  117. [
  118. .B fsys
  119. .I name
  120. ]
  121. .B bfree
  122. .I addr
  123. .PP
  124. [
  125. .B fsys
  126. .I name
  127. ]
  128. .B block
  129. .I addr
  130. .I offset
  131. [
  132. .I count
  133. [
  134. .I data
  135. ]]
  136. .PP
  137. [
  138. .B fsys
  139. .I name
  140. ]
  141. .B clre
  142. .I addr
  143. .I offsets
  144. \&...
  145. .PP
  146. [
  147. .B fsys
  148. .I name
  149. ]
  150. .B clri
  151. .I files
  152. \&...
  153. .PP
  154. [
  155. .B fsys
  156. .I name
  157. ]
  158. .B clrp
  159. .I addr
  160. .I offset
  161. \&...
  162. .PP
  163. [
  164. .B fsys
  165. .I name
  166. ]
  167. .B create
  168. .I path
  169. .I uid
  170. .I gid
  171. .I perm
  172. .PP
  173. [
  174. .B fsys
  175. .I name
  176. ]
  177. .B epoch
  178. [
  179. .B -y
  180. ]
  181. .I n
  182. .PP
  183. [
  184. .B fsys
  185. .I name
  186. ]
  187. .B label
  188. .I addr
  189. [
  190. .I type
  191. .I state
  192. .I epoch
  193. .I epochclose
  194. .I tag
  195. ]
  196. .PP
  197. [
  198. .B fsys
  199. .I name
  200. ]
  201. .B remove
  202. .I files
  203. \&...
  204. .PP
  205. [
  206. .B fsys
  207. .I name
  208. ]
  209. .B snap
  210. [
  211. .B -a
  212. ]
  213. .PP
  214. [
  215. .B fsys
  216. .I name
  217. ]
  218. .B snaptime
  219. [
  220. .B -a
  221. .I hhmm
  222. ]
  223. [
  224. .B -s
  225. .I interval
  226. ]
  227. .PP
  228. [
  229. .B fsys
  230. .I name
  231. ]
  232. .B stat
  233. .IR files ...
  234. .PP
  235. [
  236. .B fsys
  237. .I name
  238. ]
  239. .B sync
  240. .PP
  241. [
  242. .B fsys
  243. .I name
  244. ]
  245. .B vac
  246. .I dir
  247. .PP
  248. [
  249. .B fsys
  250. .I name
  251. ]
  252. .B wstat
  253. .I file
  254. .I elem
  255. .I uid
  256. .I gid
  257. .I perm
  258. .I length
  259. .SH DESCRIPTION
  260. These are configuration and maintenance commands
  261. executed at the console of a
  262. .IR fossil (4)
  263. file server.
  264. The commands are split into three groups above:
  265. file server configuration,
  266. file system configuration,
  267. and file system maintenance.
  268. This manual page is split in the same way.
  269. .SS File server configuration
  270. .PP
  271. The
  272. dot
  273. .RI ( . )
  274. command
  275. reads
  276. .IR file ,
  277. treating each line as a command to be executed.
  278. Blank lines and lines beginning with a
  279. .L #
  280. character are ignored.
  281. Note that
  282. .I file
  283. is a file in the name space in which
  284. .I fossil
  285. was started,
  286. .I not
  287. a file in any file system served by
  288. .IR fossil .
  289. .PP
  290. .I 9p
  291. executes a 9P transaction; the arguments
  292. are in the same format used by
  293. .IR 9pcon (8).
  294. .PP
  295. .I Dflag
  296. toggles the debug flag and prints the new setting.
  297. When the debug flag is set, all protocol messages
  298. and information about authentication is printed to
  299. standard error.
  300. .PP
  301. .I Echo
  302. behaves identically to
  303. .IR echo (1),
  304. writing to the console.
  305. .PP
  306. .I Listen
  307. manages the network addresses at which
  308. fossil is listening.
  309. With no arguments,
  310. .I listen
  311. prints the current list of addresses and their network directories.
  312. With one argument, listen
  313. .I address
  314. starts a new listener at
  315. .IR address ;
  316. the
  317. .B -d
  318. flag causes
  319. .I listen
  320. to remove the listener
  321. at the given address.
  322. .PP
  323. .I Msg
  324. prints the maximum internal 9P message queue size
  325. and the maximum number of 9P processes to
  326. allocate for serving the queue.
  327. The
  328. .B -m
  329. and
  330. .B -p
  331. options set the two variables.
  332. .PP
  333. .I Uname
  334. displays or edits one entry the in-memory user table.
  335. If the in-memory table was read from a file
  336. (see the
  337. .I users
  338. command below),
  339. the new table is written to
  340. .IR /active/adm/users .
  341. There is no distinction between users and groups:
  342. a user is a group with one member.
  343. The user table records a mapping between
  344. uids and unames, as well as recording the
  345. leader and members of each group.
  346. A
  347. .I uid
  348. is a string naming a user or group
  349. and stored in the on-disk data structures.
  350. A
  351. .I uname
  352. is the string naming a user or group and
  353. used in 9P protocol messages.
  354. There is a distinction so that unames can be
  355. safely reused, even though uids cannot.
  356. The first argument to
  357. .I uname
  358. is (confusingly) a
  359. uname
  360. .RI ` uname .'
  361. The second argument is an optional verb, one of:
  362. .TP
  363. .I uid
  364. add the user with uname
  365. .RI ` uname '
  366. and uid
  367. .RI ` uid ,'
  368. creating a home directory
  369. .BI /active/usr/ uname \fR.
  370. .TP
  371. .BI : uid
  372. add the user but do not create the home directory
  373. .TP
  374. .BI % newname
  375. rename
  376. .RI ` uname '
  377. to
  378. .RI ` newname ,'
  379. throughout the user table
  380. .TP
  381. .BI = leader
  382. set the group leader to the uname
  383. .IR leader .
  384. .TP
  385. .BI + member
  386. add the uname
  387. .RI ` member '
  388. to the group
  389. .TP
  390. .BI - member
  391. remove the uname
  392. .RI ` member '
  393. from the group
  394. .LP
  395. If the verb is omitted, the entire entry for
  396. .I uname
  397. is printed, in the form:
  398. .IP
  399. .IB uid : uname : leader :\fImembers
  400. .LP
  401. where
  402. .I members
  403. is a comma-separated list of unames.
  404. .PP
  405. .I Users
  406. reads
  407. .IR file
  408. from the file system named
  409. .B main
  410. and uses it to initialize the user table.
  411. With no arguments,
  412. .I users
  413. prints the file name of the current user table.
  414. .PP
  415. The user table is a list of lines in the form printed
  416. by the
  417. .I uname
  418. command.
  419. The
  420. .B -d
  421. flag resets the user table to the default:
  422. .IP
  423. .EX
  424. adm:adm:adm:sys
  425. none:none::
  426. noworld:noworld::
  427. sys:sys::
  428. .EE
  429. .PP
  430. These users are mandatory and must appear in all user files read.
  431. It is not possible to rename these unames.
  432. .PP
  433. The
  434. .B -w
  435. flag causes the file
  436. .I /active/adm/users
  437. to be written with the current in-memory table.
  438. The path
  439. .I /active/adm
  440. must exist.
  441. .PP
  442. .I Srv
  443. behaves like listen but uses
  444. .BI /srv/ name
  445. rather than a network address.
  446. With the
  447. .B -p
  448. flag,
  449. .I srv
  450. edits a list of console services rather than 9P services.
  451. .SS File system configuration
  452. .I Fsys
  453. sets the current file system to
  454. .IR name ,
  455. which must be configured and open (q.v.).
  456. The current file system name is
  457. displayed as the file server prompt.
  458. .PP
  459. .I Fsys
  460. takes as an optional argument
  461. (after
  462. .BR name )
  463. a command to execute on the named file system.
  464. Most commands require that the named file system
  465. be configured and open; these commands can be invoked
  466. without the
  467. .BI fsys " name
  468. prefix, in which case the current file system is used.
  469. A few commands
  470. .RB ( config ,
  471. .BR open ,
  472. and
  473. .BR unconfig )
  474. operate on unopened file systems; they require the prefix.
  475. .PP
  476. .I Config
  477. creates a new file system named
  478. .I name
  479. using disk file
  480. .I device .
  481. This just adds an entry to fossil's internal table.
  482. .PP
  483. .I Venti
  484. establishes a connection to the Venti server
  485. .I host
  486. (by default, the environment variable
  487. .B $venti
  488. or the network variable
  489. .BR $venti )
  490. for use by the named file system.
  491. If no
  492. .I venti
  493. command is issued before
  494. .IR open ,
  495. the default Venti server will be used.
  496. The
  497. .B -d
  498. flag closes the connection to the Venti server
  499. and can only be used when the file system is closed.
  500. The
  501. .B -r
  502. flag redials the Venti server and can only
  503. be used when the file system is open;
  504. .I host
  505. must be given again.
  506. .PP
  507. .I Open
  508. opens the file system, reading the
  509. root and super blocks and allocating an in-memory
  510. cache for disk and Venti blocks.
  511. The options are:
  512. .TP
  513. .B -A
  514. run with no authentication
  515. .TP
  516. .B -P
  517. run with no permission checking
  518. .TP
  519. .B -W
  520. allow wstat to make arbitrary changes to the user and group fields
  521. .TP
  522. .B -r
  523. open the file system read-only
  524. .TP
  525. .BI -c " ncache
  526. allocate an in-memory cache of
  527. .I ncache
  528. (by default, 1000)
  529. blocks
  530. .PP
  531. .I Close
  532. flushes all dirty file system blocks to disk
  533. and then closes the device file.
  534. .PP
  535. .I Unconfig
  536. removes the named file system (which must be closed)
  537. from fossil's internal table.
  538. .SS File system maintenance
  539. .I Bfree
  540. marks the block at disk address
  541. .I addr
  542. as available for allocation.
  543. Before doing so, it prints a
  544. .I label
  545. command (q.v.)
  546. that can be used to restore the block to its previous state.
  547. .PP
  548. .I Block
  549. displays (in hexadecimal)
  550. the contents of the block at disk address
  551. .IR addr ,
  552. starting at
  553. .I offset
  554. and continuing for
  555. .I count
  556. bytes or until the end of the block.
  557. If
  558. .I data
  559. (also hexadecimal)
  560. is given, the contents in that range are
  561. replaced with data.
  562. When writing to a block,
  563. .I block
  564. prints the old and new contents,
  565. so that the change is easily undone.
  566. Editing blocks is discouraged.
  567. .PP
  568. .I Clre
  569. zeros an entry from a disk block.
  570. Before doing so, it prints a
  571. .I block
  572. command that can be used
  573. to restore the entry.
  574. .PP
  575. .I Clri
  576. removes the internal directory entry
  577. and abandons storage associated with
  578. .IR files .
  579. It ignores the usual rules for sanity, such as checking against
  580. removing a non-empty directory.
  581. A subsequent
  582. .I flchk
  583. (see
  584. .IR fossil (4))
  585. will identify the abandoned storage so it can be reclaimed with
  586. .I bfree
  587. commands.
  588. The
  589. .I perm
  590. is formatted as described in the
  591. .I stat
  592. command ;
  593. creating files or directories with the
  594. snapshot
  595. .RB ( s )
  596. bit set is not allowed.
  597. .PP
  598. .I Clrp
  599. zeros a pointer in a disk block.
  600. Before doing so, it prints a
  601. .I block
  602. command that can be used to restore the entry.
  603. .PP
  604. .I Create
  605. creates a file on the current file system.
  606. .I Uid
  607. and
  608. .I gid
  609. are uids
  610. .RI ( not
  611. unames;
  612. see the discussion above, in the description
  613. of the
  614. .I uname
  615. command).
  616. .I Perm
  617. is the low 9 bits of the permission mode of the file,
  618. in octal.
  619. The
  620. .BR -a ,
  621. .BR -d ,
  622. and
  623. .B -l
  624. flags set the append-only, directory, and lock bits.
  625. .PP
  626. .I Epoch
  627. sets the low file system epoch.
  628. Snapshots in the file system are given increasing epoch numbers.
  629. The file system maintains a low and a high epoch number,
  630. and only allows access to snapshots in that range.
  631. The low epoch number can be moved forward to discard old snapshots
  632. and reclaim the disk space they occupy.
  633. (The high epoch number is always the epoch of the currently
  634. active file system.)
  635. .PP
  636. The command
  637. ``\fLepoch\fI n''\fR
  638. is used to propose changing the low epoch to
  639. .IR n .
  640. In response,
  641. .I fossil
  642. scans
  643. .B /archive
  644. and
  645. .B /snapshot
  646. for snapshots that would be discarded, printing their
  647. epoch numbers and the
  648. .I clri
  649. commands necessary to remove them.
  650. The epoch is changed only if no such paths are found.
  651. The usual sequence of commands is (1) run epoch to
  652. print the snapshots and their epochs, (2) clri some snapshots,
  653. (3) run epoch again.
  654. If the file system is completely full (there are no free blocks),
  655. .I clri
  656. may fail because it needs to allocate blocks.
  657. For this situation,
  658. the
  659. .B -y
  660. flag to epoch forces the epoch change even when
  661. it means discarding currently accessible snapshots.
  662. Note that when there are still snapshots in
  663. .BR /archive ,
  664. the archiver should take care
  665. of those snapshots (moving the blocks from disk to Venti)
  666. if you give it more time.
  667. .PP
  668. .I Label
  669. displays and edits the label associated with a block.
  670. When editing, a parameter of
  671. .B -
  672. means leave that field unchanged.
  673. Editing labels is discouraged.
  674. .PP
  675. .I Remove
  676. removes
  677. .IR files .
  678. .PP
  679. .I Snap
  680. takes a temporary snapshot of the current file system,
  681. recording it in
  682. .BI /snapshot/ yyyy / mmdd / hhmm \fR,
  683. as described in
  684. .IR fossil (4).
  685. The
  686. .B -a
  687. flag causes
  688. .I snap
  689. to take an archival snapshot, recording it in
  690. .BI /archive/ yyyy / mmdd \fR,
  691. also described in
  692. .IR fossil (4).
  693. .PP
  694. .I Snaptime
  695. displays and edits the times at which snapshots are automatically
  696. taken.
  697. An archival snapshot is taken once a day, at
  698. .IR hhmm ,
  699. while temporary snapshots are taken at multiples of
  700. .I interval
  701. minutes.
  702. With no arguments,
  703. .I snaptime
  704. prints the current snapshot times.
  705. The
  706. .B -a
  707. and
  708. .B -s
  709. options set the archive and snapshot times.
  710. An
  711. .I hhmm
  712. or
  713. .I interval
  714. of
  715. .L none
  716. can be used to disable that kind of automatic snapshot.
  717. By default, both are disabled.
  718. .PP
  719. .I Stat
  720. displays metadata for each of the named
  721. .IR files ,
  722. in the form:
  723. .IP
  724. .EX
  725. stat \fIfile elem uid gid perm length
  726. .EE
  727. .LP
  728. (Replacing
  729. .B stat
  730. with
  731. .B wstat
  732. yields a valid command.)
  733. The
  734. .I perm
  735. is an octal number less than or equal to 777,
  736. prefixed with any of the following letters
  737. to indicate additional bits.
  738. .IP
  739. .EX
  740. .ta +4n
  741. a \fRappend only
  742. d \fRdirectory
  743. l \fRexclusive use
  744. s \fRis the root of a snapshot
  745. A \fRMS-DOS archive bit
  746. G \fRsetgid
  747. H \fRMS-DOS hidden bit
  748. L \fRsymbolic link
  749. S \fRMS-DOS system bit
  750. T \fRMS-DOS temporary bit
  751. U \fRsetuid
  752. Y \fRsticky
  753. .EE
  754. The bits denoted by capital letters are included
  755. to support non-Plan 9 systems.
  756. They are not made visible by the 9P protocol.
  757. .PP
  758. .I Sync
  759. writes dirty blocks in memory to the disk.
  760. .PP
  761. .I Vac
  762. prints the Venti score for a
  763. .IR vac (1)
  764. archive containing the tree rooted
  765. at
  766. .IR dir ,
  767. which must already be archived to Venti
  768. (typically
  769. .IR dir
  770. is a directory in the
  771. .B /archive
  772. tree).
  773. .PP
  774. .I Wstat
  775. changes the metadata of the named
  776. .IR file .
  777. Specifying
  778. .B -
  779. for any of the fields means ``don't change.''
  780. Attempts to change the
  781. .B d
  782. or
  783. .B s
  784. bits in the
  785. .I perm
  786. are silently ignored.
  787. .SH EXAMPLE
  788. .IR Sources ,
  789. the Plan 9 distribution file server,
  790. uses the following configuration file:
  791. .IP
  792. .EX
  793. srv -p fscons.sources
  794. srv -p fscons.sources.adduserd
  795. srv sources
  796. fsys main config /dev/sdC0/fossil.outside
  797. fsys main open -c 25600
  798. fsys main
  799. users /active/adm/users
  800. listen tcp!*!564
  801. msg -m 40 -p 10
  802. snaptime -a 0000 -s 15
  803. .EE
  804. .LP
  805. The second console is used by the daemon
  806. that creates new accounts.